Skip to content

bug: test_real_mysql_recovery_upgrade_preserves_receipt_and_resumes_registered_ddl_prefix intermittently hangs on embedded seekdb in code-seekdb (3.11) #2221

Closed

Description

@Fengzdadi

Describe the bug

test_real_mysql_recovery_upgrade_preserves_receipt_and_resumes_registered_ddl_prefix sometimes hangs on embedded seekdb in code-seekdb (3.11). The step "Test unified migrations with embedded seekdb" then hits its 10-minute limit and the job fails. On a passing job the two seekdb cases take 17 s and 28 s.

It happened twice on #2206, which changes only atomic_memory_processing.py, tests and docs, none of which are on this path:

Run Date Case code-seekdb (3.14) Rerun
job 120270681845 2026-10-23 [True-seekdb] passed attempt 2 passed
job 120784102219 2026-10-24 [False-seekdb] passed not rerun

For scale: the latest attempts of the 57 Main runs since 2026-10-23 02:46 UTC that reached code-seekdb (3.11) passed 46 times, were cancelled 7 times and failed 4 times. One of those failures is the 2026-10-24 run above. The other three are on two other branches; the one I checked timed out in a different test. First attempts that were rerun to success, like the 2026-10-23 run, do not appear in these counts.

Steps to reproduce

  1. Run the Main workflow on a commit based on 464cd15, for example perf(atomic-memory): skip reconciliation when a candidate has nothing to compare #2206.
  2. In code-seekdb (3.11), the step "Test unified migrations with embedded seekdb" runs tests/e2e/test_topic_memory_recovery_migration.py -k seekdb with faulthandler_timeout=120.
  3. Intermittently, one of the two seekdb cases does not finish.

I have not reproduced this locally.

Expected behavior

The migration finishes in seconds, as in the passing runs. If a statement can block, the test or the maintenance connection fails within a bounded time instead of holding the step until the job timeout.

Actual behavior

faulthandler dumps the same stacks after 120 s in both runs (2026-10-24 shown, frames at 464cd15):

So an await inside the seekdb maintenance operation never completes; the Python dump cannot show which one. In the [False-seekdb] case this is the only apply call, made after the test has closed its own profile for the seeded data.

tests/e2e/test_topic_memory_recovery_migration.py::test_real_mysql_recovery_upgrade_preserves_receipt_and_resumes_registered_ddl_prefix[False-seekdb] Timeout (0:02:00)!
Thread 0x00007f4a717ff6c0 (most recent call first):
  File ".../asyncio/runners.py", line 190 in run
  File ".../src/powercontext/builtin/persistence/migrations/connections.py", line 115 in run
  File ".../src/powercontext/builtin/persistence/migrations/topic_memory_recovery.py", line 292 in _run
  File ".../src/powercontext/builtin/persistence/migrations/topic_memory_recovery.py", line 516 in apply
  File ".../tests/e2e/test_topic_memory_recovery_migration.py", line 534 in apply_skipping_backup
Thread 0x00007f4a8b9abb80 (most recent call first):
  File ".../asyncio/runners.py", line 190 in run
  File ".../tests/e2e/test_topic_memory_recovery_migration.py", line 581 in test_real_mysql_recovery_upgrade_preserves_receipt_and_resumes_registered_ddl_prefix
...
##[error]The action 'Test unified migrations with embedded seekdb' has timed out after 10 minutes.

Both runs uploaded seekdb-migrations-3.11 (7.6 MB and 11.6 MB) with the native seekdb logs that the step collects. I have not inspected them; they may show which statement or lock was waiting.

Environment

Are you willing to submit a PR to fix this bug?

  • Yes, I am willing to submit a PR!

Activity

  1. Fengzdadi commented on Oct 25, 2026

    @Fengzdadi
    CollaboratorAuthor

    The hang is still recurring, and not only on Python 3.11. Since this issue was opened, five jobs in four more Main runs have stopped at the same stack (TopicMemoryRecoveryMigrationRunner.apply → MaintenanceConnections.run, with the event loop idle in selectors.select):

    Date (UTC) Branch Job Case
    2026-10-24 s3 code-seekdb (3.14) [True-seekdb]
    2026-10-24 perf/incubation-experience-snapshot code-seekdb (3.14) [True-seekdb]
    2026-10-25 perf/handoff-report-batch-heads code-seekdb (3.11) [False-seekdb]
    2026-10-25 perf/handoff-report-batch-heads code-seekdb (3.14) [False-seekdb]
    2026-10-25 codex/batch-archive-compatibility-2169 code-seekdb (3.14) [True-seekdb]

    Native log from the 2026-10-25 [False-seekdb] failure on 3.11

    I went through seekdb-native.tar.gz in the seekdb-migrations-3.11 artifact of run 40167105349. It covers four opens of the same data directory, at 06:21:09, 06:21:11, 06:21:14 and 06:21:17 UTC.

    1. In the second instance, at 06:21:14.394, the background thread T1_MaintainDepI acquires the RUNTIME:1 X lock (IN_TRANS_COMMON_LOCK) in transaction 1000004 and registers it as a multi-data-source (MDS) operation. The transaction starts to commit (TX_END), but neither ON_REDO nor ON_COMMIT is logged in this instance.
    2. At 06:21:14.413, about 20 ms later, the instance logs no clients remaining, exiting.
    3. The third and fourth instances both replay 1000004 from redo (REGISTER_SUCC, ON_REDO), and it never reaches ON_COMMIT or an abort. Of the 46 MDS transactions in the fourth instance, it is the only one left undecided. All the others commit, including 1000002, which the same thread opened on the same lock about 40 ms earlier.
    4. In the fourth instance, the migration's ALTER TABLE pc_topic_memory_work_budgets statements (tablet 200001) acquire their table locks, and those lock transactions commit. The DDL task created at 06:21:19.085 then enters ddl wait trans end (need_wait_trans_end:true) and retries 30,590 times until the log ends at 06:30:45.

    Why a replayed transaction can block the wait

    Every source line this log cites that I checked, in the DDL, tablet and transaction modules, matches the seekdb v1.4.0 source. The following is based on that source:

    • ObLSTxCtxMgr::check_modify_schema_elapsed visits the transaction contexts on the log stream, regardless of which tablet the DDL targets, and stops at the first context that fails the check.
    • For a context that is still is_for_replay() and not exiting, ObTxCtx::check_modify_schema_elapsed returns OB_STATE_NOT_MATCH.
    • OB_STATE_NOT_MATCH is in the DDL retry white list (is_not_master), so try_wait keeps returning ret=0 with the transaction not yet ended, and the task retries indefinitely.

    The log is consistent with this path. ObTablet::check_schema_version_elapsed logs at INFO when the transaction check returns OB_EAGAIN (check schema version elapsed again) and when it succeeds (check wait trans end). Neither message appears in 30,590 checks. In every check, then, some context failed with an error other than OB_EAGAIN before any context returned OB_EAGAIN. That error is logged only at WARN, and this log contains no WARN lines. A live transaction holding an older lock on the table therefore cannot be the only thing blocking the wait, but the log does not record which context did. The transaction context count, which the log reports periodically, stays at one or more for the whole wait. That fits one context that never ends, but the log does not identify it. 1000004 is a recovered, undecided transaction of the kind this path rejects. The log does not show the outcome of replayed non-MDS transactions, so 1000004 may not be the only such context.

    #1920 diagnosed this mechanism. Replay reconstructs an undecided transaction from a closed instance, and nothing ever completes it. There, the visible symptom was CREATE TABLE pc_schema_revision waiting on the RUNTIME:1 lock. Here, it is a DDL task waiting for transactions to end. I have not inspected the native logs of the 3.14 failures.

    Fix

    oceanbase/seekdb#1499 targets this case. It takes over recovered transactions before admitting new ones and aborts undecided MDS table-lock transactions. However, its description notes that its regressions do not include an MDS table-lock recovery case, which is the kind of transaction found here. So this needs to be validated against a build that contains it.

    PowerContext does not appear to need a code change. The fix is to move to a pylibseekdb release that contains seekdb#1499, update uv.lock, and check repeated runs on Python 3.11 and 3.14, as planned in #1945. seekdb#1499 merged on 2026-10-15. The latest pylibseekdb on PyPI is still 1.4.0.post1, from 2026-09-14, and the latest seekdb GitHub release is v1.4.0.

    @wangyunlai-seekdb, is a pylibseekdb release that includes seekdb#1499 planned, and roughly when? A pre-release wheel would also let us check this case and #1920 before the final release.

    cc @Zxf-xufeng, since #1945 tracks the dependency upgrade.

  2. PsiACE commented on Nov 2, 2026

    @PsiACE
    Member

    Resolved by the patched SeekDB dependency in #1945 and the native restart and migration-recovery regressions in #2328.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions