Repository navigation
Commit bd5624b
committed
Build/Test Tools: Avoid Node 24 hang on grunt exit
Grunt ends a successful run with `process.exit(0)`. Node's exit handler
joins the V8 platform worker pool; if a background compile job is parked
in CollectionBarrier::AwaitCollectionBackground waiting for a garbage
collection the main thread can no longer run, the two deadlock and the
build hangs after printing "Done.". Node 24 enables both Maglev and
concurrent Sparkplug, Node 22 enabled neither, which is why this only
appears after the upgrade to Node 24.
Disable both compilers from Gruntfile.js with v8.setFlagsFromString().
NODE_OPTIONS rejects V8 flags, so they cannot be set there, and setting
them in the Gruntfile keeps every entry point plain `grunt`: nested
grunt children, grunt-contrib-watch and tools/gutenberg/utils.js all
load this same Gruntfile and inherit the change with no extra plumbing.
The tradeoff is that this narrows the window rather than closing it.
Code compiled before Gruntfile.js is read, that is grunt-cli and grunt's
own module loading, remains eligible for Maglev. Measured on Node 24.15
with `node --trace-opt node_modules/grunt/bin/grunt jshint`, counting
"target MAGLEV" lines: 1443 unpatched, 88 with this change, 0 with the
flags passed at process startup. The remaining 88 complete in
microseconds, long before exit.
See #66116, nodejs/node#64274.1 parent 1612235 commit bd5624b
1 file changed
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
3 | 19 | | |
4 | 20 | | |
5 | 21 | | |
| |||
0 commit comments