mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #6560] [MERGED] fix: let processes exit when they log while the log worker starts #7227
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#7227
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6560
Author: @kolacheee
Created: 9/23/2026
Status: ✅ Merged
Merged: 9/23/2026
Merged by: @kolacheee
Base:
staging← Head:fix/image-dimension-regression-hang📝 Commits (2)
3c6aeadfix: let processes exit when they log while the log worker startsc3f8ef8test: drive the log-worker handshake through a real thread-stream📊 Changes
7 files changed (+163 additions, -5 deletions)
View changed files
📝
CHANGELOG.md(+2 -0)➕
patches/thread-stream@4.2.0.patch(+64 -0)📝
pnpm-lock.yaml(+5 -2)📝
pnpm-workspace.yaml(+2 -0)➕
scripts/regressions/fixtures/thread-stream-ready-worker.cjs(+27 -0)➕
scripts/regressions/log-worker-ready.regression.ts(+59 -0)📝
scripts/run-regressions.mjs(+4 -3)📄 Description
Linked issue
Closes #6529
Why this change
image-dimension-limit.regression.tspasses every assertion, prints its success line, and then never exits, so the runner kills it at 30 seconds and the lane fails. It hit roughly one full lane in three.The issue guessed at a keep-alive socket. It is not one. With a diagnostic dump at hang time, the only live handle is a
MessagePort: the worker thread that pino-pretty runs in outside production. The worker stays referenced until a READY handshake sees its read index reach a write index it recorded earlier.thread-stream4.2.0 checks that with===. This spec logs retry warnings while the worker is still starting, so the read index can jump past the recorded value, or be reset under it, and the handshake never finishes. Every hung run showed the same state:ready: false, read index equal to write index.Upstream fixed exactly this in pinojs/thread-stream#246 and #251 (issues #245 and #250), but no release carries it yet: npm's latest is still 4.2.0.
The spec is not the root cause, so the spec is unchanged. The same race can keep any non-production process open:
pnpm dev, scripts, other regressions. User installs are not affected, becausestart.shandstart.batsetNODE_ENV=production, which skips the pretty worker.What changed
patches/thread-stream@4.2.0.patchapplies upstream's two commits (index.js+1 line,lib/wait.js), registered inpnpm-workspace.yamlnext to the existing onnxruntime patch, with a note to drop it once a release after 4.2.0 ships the fix. The Dockerfiles already copypatches/.log-worker-ready.regression.tsdrives a realThreadStream, the copy pino loads, through a scripted worker swapped in with thread-stream's own worker-path hook, as upstream's tests do. One scenario reads past the handshake's recorded value; the other overfills a 4-byte buffer so thread-stream's ownflushSyncandresetIndexesrun twice while the handshake is pending. Both fail on unpatched 4.2.0 (noreadywithin 5 s) and pass with the patch.1 failedwith no failing file named in the summary.Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
What the agent ran:
image-dimension-limit.regression.tsalone, same machine, same loop: 11 of 30 runs hung after printing success on unpatched staging, 0 of 40 with the patch.log-worker-ready.regression.tsagainst the unpatched and patched copies ofthread-stream: both scenarios fail on the first and pass on the second, 25 of 25 runs.pnpm install --frozen-lockfilewith the patch;pnpm check; the fullpnpm regression:nodelane (358/358, after rebasing onto staging with #6556). A local CodeRabbit review reported 0 findings.podman build -f Dockerfile: both installs (full and--prod) applied the patch, the image contains only the patchedthread-stream, and the container answered/api/healthwith 200.Still to verify by hand:
pnpm regressiona few times and confirmimage-dimension-limit.regression.tsno longer times out.Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)CHANGELOG entry added under
[Unreleased]. No docs underdocs/change.UI evidence (if applicable)
Not applicable, no UI change.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.