[GH-ISSUE #6360] [Issue]: file-backed-shutdown regression passes every check, then sometimes hangs at exit until the 30 s timeout #3555

Closed
opened 2026-10-21 06:04:15 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @kolacheee on GitHub (Sep 19, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6360

Summary

scripts/regressions/file-backed-shutdown.regression.ts sometimes passes every one of its checks and then does not exit. The runner kills it at its fixed 30 second budget and the whole node regression lane goes red. It has done this on the first CI run of three unrelated pull requests (#6323, #6336, #6345) and once locally, and it passes when run again.

Expected behavior

The regression exits as soon as its last check has passed. Alone it takes about half a second.

Actual behavior

The last lines before the timeout are always the final two success messages, so nothing in the test failed. The process simply stays alive:

[scripts/regressions/file-backed-shutdown.regression.ts] stdout: File-backed capability schema identity regression passed.
[scripts/regressions/file-backed-shutdown.regression.ts] stdout: File-backed unique-key regression passed.
[scripts/regressions/file-backed-shutdown.regression.ts] TIMEOUT after 30s; terminating child.
[scripts/regressions/file-backed-shutdown.regression.ts] TIMEOUT (30123ms)
Regression summary: 322/323 passed; 1 failed.

Run on its own right afterwards, on the same tree:

File-backed capability schema identity regression passed.
File-backed unique-key regression passed.
real    0m0.536s

Something keeps the event loop open after the last store is closed, and only some of the time. That points at a handle one of the eight createFileNativeDB() stores in the file leaves behind (a timer, a lease heartbeat, a pending flush) rather than at anything the test asserts.

Steps to reproduce

  1. Run pnpm regression:node on staging, ideally on a busy machine (the local occurrence happened while two other check runs were using the CPU).
  2. Most runs pass. Now and then file-backed-shutdown.regression.ts prints its last success line and then sits until the 30 second timeout.
  3. Run the file alone: it passes in well under a second.

Environment

  • Marinara Engine version: staging (seen between 2026-09-18 and 2026-09-19, latest on d71106851 plus local changes that do not touch the file store)
  • Install type: source (CI node regression lane, and a local Fedora checkout)
  • OS + version: GitHub-hosted Ubuntu runner; Fedora Linux 44, Node 24.21
  • Browser or app shell: none

Logs, screenshots, or video

See the excerpt above. The CI occurrences were the first node-lane runs of #6323, #6336 and #6345; each passed when re-run or when the next push restarted CI.

Additional context

Leads, not conclusions:

  • One block in the test builds a store whose close() is made to reject on purpose (await assert.rejects(db._fileStore.close(), expectedFailure)). If a store that fails to close keeps a timer or its writer lease heartbeat alive, the process would hang exactly like this, and only when that timer happens to be armed at the moment the script ends.
  • process.getActiveResourcesInfo() printed at the end of the script (or --trace-exit style logging of open handles) on a hung run would name the handle directly.
  • If the handle turns out to be legitimate for a server but not for a script, the smallest fix on the test side is an explicit exit once the last check has passed; the better one is unref() on, or clearing of, whatever the failed close leaves behind.

Related: #6353 is the other recurring CI flake from the same two days (a browser heap budget), filed separately because it has nothing in common with this one.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @kolacheee on GitHub (Sep 19, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/6360 ## Summary `scripts/regressions/file-backed-shutdown.regression.ts` sometimes passes every one of its checks and then does not exit. The runner kills it at its fixed 30 second budget and the whole node regression lane goes red. It has done this on the first CI run of three unrelated pull requests (#6323, #6336, #6345) and once locally, and it passes when run again. ## Expected behavior The regression exits as soon as its last check has passed. Alone it takes about half a second. ## Actual behavior The last lines before the timeout are always the final two success messages, so nothing in the test failed. The process simply stays alive: ``` [scripts/regressions/file-backed-shutdown.regression.ts] stdout: File-backed capability schema identity regression passed. [scripts/regressions/file-backed-shutdown.regression.ts] stdout: File-backed unique-key regression passed. [scripts/regressions/file-backed-shutdown.regression.ts] TIMEOUT after 30s; terminating child. [scripts/regressions/file-backed-shutdown.regression.ts] TIMEOUT (30123ms) Regression summary: 322/323 passed; 1 failed. ``` Run on its own right afterwards, on the same tree: ``` File-backed capability schema identity regression passed. File-backed unique-key regression passed. real 0m0.536s ``` Something keeps the event loop open after the last store is closed, and only some of the time. That points at a handle one of the eight `createFileNativeDB()` stores in the file leaves behind (a timer, a lease heartbeat, a pending flush) rather than at anything the test asserts. ## Steps to reproduce 1. Run `pnpm regression:node` on `staging`, ideally on a busy machine (the local occurrence happened while two other check runs were using the CPU). 2. Most runs pass. Now and then `file-backed-shutdown.regression.ts` prints its last success line and then sits until the 30 second timeout. 3. Run the file alone: it passes in well under a second. ## Environment - Marinara Engine version: `staging` (seen between 2026-09-18 and 2026-09-19, latest on d71106851 plus local changes that do not touch the file store) - Install type: source (CI node regression lane, and a local Fedora checkout) - OS + version: GitHub-hosted Ubuntu runner; Fedora Linux 44, Node 24.21 - Browser or app shell: none ## Logs, screenshots, or video See the excerpt above. The CI occurrences were the first node-lane runs of #6323, #6336 and #6345; each passed when re-run or when the next push restarted CI. ## Additional context Leads, not conclusions: - One block in the test builds a store whose `close()` is made to reject on purpose (`await assert.rejects(db._fileStore.close(), expectedFailure)`). If a store that fails to close keeps a timer or its writer lease heartbeat alive, the process would hang exactly like this, and only when that timer happens to be armed at the moment the script ends. - `process.getActiveResourcesInfo()` printed at the end of the script (or `--trace-exit` style logging of open handles) on a hung run would name the handle directly. - If the handle turns out to be legitimate for a server but not for a script, the smallest fix on the test side is an explicit exit once the last check has passed; the better one is `unref()` on, or clearing of, whatever the failed close leaves behind. Related: #6353 is the other recurring CI flake from the same two days (a browser heap budget), filed separately because it has nothing in common with this one. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 06:04:15 +07:00
Author
Owner

@SpicyMarinara commented on GitHub (Sep 19, 2026):

I am taking this in #6359. Owner: @SpicyMarinara, assisted by Codex. I will trace the remaining handles and add a regression for the shutdown lifecycle rather than mask the hang with process.exit.

<!-- gh-comment-id:5741974871 --> @SpicyMarinara commented on GitHub (Sep 19, 2026): I am taking this in #6359. Owner: @SpicyMarinara, assisted by Codex. I will trace the remaining handles and add a regression for the shutdown lifecycle rather than mask the hang with process.exit.
Author
Owner

@SpicyMarinara commented on GitHub (Sep 19, 2026):

Merged to staging in #6359. The shutdown fixture now uses production logging to avoid the unrelated asynchronous pretty-logger worker and asserts that every store releases its beforeExit hook, including failed closes. No force-exit was added. The original intermittent hang did not reproduce in 125 local stress runs, so this is a fixture mitigation with an explicit reproduction gap.

<!-- gh-comment-id:5742479125 --> @SpicyMarinara commented on GitHub (Sep 19, 2026): Merged to staging in #6359. The shutdown fixture now uses production logging to avoid the unrelated asynchronous pretty-logger worker and asserts that every store releases its beforeExit hook, including failed closes. No force-exit was added. The original intermittent hang did not reproduce in 125 local stress runs, so this is a fixture mitigation with an explicit reproduction gap.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#3555
No description provided.