Repository navigation
[PR] fix(storage): stop a running background quick_check on exit instead of waiting for it - #7260
mariopasquali wants to merge 3 commits into
Conversation
…f waiting for it (ranxianglei#6987) The background quick_check ran in a worker thread. The scan is one synchronous sqlite3_step that cannot be interrupted (node:sqlite has no sqlite3_interrupt), and process.exit() joins every worker thread before the process ends. A relay stopped during the scan of a large store (about 45 min for 10 GB) therefore stayed in exit until the supervisor killed it. On Node the scan now runs in a child process that is killed when the relay exits. Bun keeps the worker thread, because a compiled host's execPath is not a runtime that can run the scan source. Closes ranxianglei#6987
…LIVE_FILES The new tests/issue6987-quickcheck-shutdown.test.ts spawnSyncs a bare node child, which trips the SPAWN_RE gate in scripts/run-ci-tests.mjs. It was never added to LIVE_FILES in scripts/live-files.mjs, so the tripwire (which scans the full file set in every shard) failed all 11 test shards before a single test ran. Concurrency reviewed: the spawn is synchronous (blocks the shard runner), the child runs under a per-run mkdtemp dir, binds no port and does no network I/O — no zone band needed, entry is for the tripwire alone, like ranxianglei#3890/ranxianglei#5114/ranxianglei#5940.
[bot] 🏷 (ai: vllm-qwen/qwen3.8-27b) 查重: 不重复。 This PR is the actual fix for #6987 (shutdown hang during the background quick_check). It is distinct from #6989 (the Review verdict: mergeable (CI green). I read the full diff, verified the root cause against the code, ran the targeted suites locally, and confirmed the full CI is green on the head. Root cause (verified). The SIGTERM path ends in Fix (correct). On Node the scan now runs in a child process ( Verification.
八问(中文):
Conclusion: mergeable. Root cause correctly diagnosed, fix minimal and correct for both runtimes, regression surface reviewed clean, CI green on the head. I can't merge (human-only) — please merge when ready: #7260 |
(ai: anthropic/claude) CI fixed — all 11 red test shards are green now. New head: What was wrong. The new The fix. One line (+ comment) appended to Verified before pushing. Tripwire logic passes locally (0 unregistered spawners); the new test passes (2.3s, well under its 60s budget); all 22 integrity-related tests pass. Post-push CI on 八问
判定:已修复并推送到 PR 分支(最终 head |
…olution for ranxianglei#7260) Conflict in scripts/live-files.mjs: both sides appended a tripwire-only LIVE_FILES entry at the list tail (master: tests/storage-integrity-cache.test.ts from ranxianglei#7156; this branch: tests/issue6987-quickcheck-shutdown.test.ts from ranxianglei#6987). Resolved by union — master's entry keeps its index (stable zone slot), this branch's entry takes the new tail slot. src/storage/integrity-check.ts auto-merged: the ranxianglei#6987 worker-to-child-process scan refactor and master's ranxianglei#7156 foreign-writer ok-cache gating coexist without overlap.
(ai: anthropic/claude) Merge conflict resolved — the PR is back to a clean, mergeable state. New head: The conflict. Master advanced past your branch point and merged #7156/#7173, which touched the same two files this PR touches. Only one real conflict: Verified before pushing. typecheck clean, build clean, CI on Note on 八问
判定:冲突已解决、CI 全绿,PR 恢复可合并状态(与昨日已合入的 #7412/#7404/#7400 同一状态),可合入。 |
[ework] CI fix verified green ✓ |
(ai: claude-opus-5-5)
Closes #6987.
Cause. A backtrace of the hung process shows the main thread in
process.exit()→Environment::Exit→stop_sub_worker_contexts→Worker::JoinThread, and the integrity worker insidesqlite3BtreeIntegrityCheck(onesqlite3_step). V8 cannot terminate a thread inside a native call, andnode:sqlitehas nosqlite3_interrupt, so exit waits for the whole scan (about 45 min on 10 GB).unref()(#6989) does not help: it only affects whether the event loop stays alive, not the join inprocess.exit(). I tested #6989 on the same store and it hangs the same way.Fix. On Node, the scan runs in a child process (
process.execPath -e) instead of a worker thread. Anexithandler kills it with SIGKILL; it holds only a read-only connection. The verdict, the cache write, the alarms and the #5940 stderr filter work as before. Bun keeps the worker thread, because theexecPathof a compiled host is the host binary.Tests
tests/issue6987-quickcheck-shutdown.test.ts: holds the scan inside one endlesssqlite3_step(a recursive CTE through a test-only SQL seam), callsprocess.exit(0), and requires a prompt exit and the scan process to be gone. With the worker thread it hangs until the test kills it after 60 s.