Repository navigation
Preserve build diagnostics during worker shutdown - #101598
Merged
Merged
Conversation
PR #97900 fixed output capture between the build CLI and the test harness. The CLI could still exit before it forwarded the static workers' final diagnostics, so debug prerenders intermittently failed without the expected sync IO error. The build now awaits static worker shutdown, and `Worker.end()` waits for stdout and stderr to finish. Neither stream ends the shared activity sink while the other can still produce output. This re-enables `sync-io-blocks-root`, whose earlier re-enablement was reverted in PR #98050.
Contributor
Tests PassedCommit: 256c205 |
unstubbable
marked this pull request as ready for review
November 11, 2026 22:10
unstubbable
requested review from
sokra
and
a balanced review from Copilot
and removed request for
Copilot
November 11, 2026 22:10
Copilot stopped reviewing on behalf of
unstubbable due to an error
November 11, 2026 22:12
eps1lon
approved these changes
Nov 12, 2026
sokra
added a commit
that referenced
this pull request
Nov 12, 2026
Replace the vendored jest-worker with a purpose-built pool in
lib/worker/: lazy spawning, boot throttling, per-worker concurrency,
crash recovery and graceful shutdown, for both child processes and
worker threads. Build, export, type-check, the dev server, the
dev-validation worker and the 'use cache' probe pool use it.
Workers exit with process.exit() after teardown on END, so leftover
ref'd handles can't hold up graceful shutdown until the force-kill
timeout ('exit' handlers such as CPU profile saving still run). Child
processes first flush their stdout/stderr pipes so final diagnostics
aren't cut off. Graceful shutdown also waits, bounded by the force-exit
delay, for each worker's output streams to end, and the Worker wrapper
resolves only once that output reached the parent's stdout/stderr
(ports #101598 to the new pool). The export worker now clears its
per-page staticPageGenerationTimeout timer once the export settles.
While CPU profiling, graceful shutdown waits up to 60 s before
force-killing a worker so large profiles aren't cut off.
Prerender early exit now throws back to the build instead of exiting
inside the worker; the CLI prints the message unchanged and deferred
Turbopack warnings still follow it. Calls whose arguments fail to
serialize, and workers whose module fails to load, reject their calls
with the real error instead of wedging or crashing the pool. Leftover
jest-worker references are removed and the Turbopack server NFT prunes
the worker child entrypoints outside standalone builds.
Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>
This was referenced Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #97900 fixed output capture between the build CLI and the test harness. The CLI could still exit before it forwarded the static workers' final diagnostics, so debug prerenders intermittently failed without the expected sync IO error.
The build now awaits static worker shutdown, and
Worker.end()waits for stdout and stderr to finish. Neither stream ends the shared activity sink while the other can still produce output.This re-enables the
sync-io-blocks-roottest suite, whose earlier re-enablement was reverted in PR #98050.