Build/Test Tools: Stop builds hanging on Node.js 24 shutdown - #13608
manzoorwanijk wants to merge 1 commit into
Conversation
Grunt ends a run with `process.exit()`. Node's exit handler joins the V8 platform worker pool, and when a background compile job is parked waiting for a garbage collection the main thread can no longer run, the two deadlock and the build never exits. Node.js 24 turns on both `--maglev` and `--concurrent-sparkplug`, where Node.js 22 had neither, which is what made this reachable. `NODE_OPTIONS` rejects V8 options, so a launcher passes them on the command line and every Grunt entry point routes through it. See nodejs/node#64274. See #66116.
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Runs Grunt with V8's concurrent Maglev and Sparkplug compilers disabled, so builds stop hanging after
Done..Grunt ends a successful run with
process.exit(0)(grunt.js:163). Node's exit handler joins the V8 platform worker pool, and when a background compile job is parked inCollectionBarrier::AwaitCollectionBackgroundwaiting for a garbage collection the main thread can no longer run, the two deadlock:Node 24 turns on both
--maglevand--concurrent-sparkplug, where Node 22 had neither, which is why this started with r63539.--concurrent-recompilationwas already on under Node 22 and costs 2.2x build time to disable, so it is left alone. Upstream: nodejs/node#64274.NODE_OPTIONSrejects V8 options, so tools/grunt.js carries them instead and every Grunt entry point routes through it. That includes thegruntscript CI calls and the nested child in utils.js:234.Previous attempts to contain this by timeout: #13564, r63643, r63647.
Testing instructions
npm run build:devand confirm the process exits rather than stalling afterDone..npm run grunt jshintand confirm the exit code still propagates.On macOS arm64 with Node 24.21.0 the stall appeared in 3 of 60 unpatched runs, always with the stack above, caught by running
sample(1)on a process still alive afterDone..Trac ticket: https://core.trac.wordpress.org/ticket/66116
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code, Codex
Model(s): Claude Opus 5, GPT-5.3 Codex
Used for: Diagnosis, the native stacks, and drafting and reviewing the launcher. I verified the stacks, measurements and final change myself.