From 3c587fd86978c0252260bf052cde35b8b50e34ab Mon Sep 17 00:00:00 2001 From: Thomas Hunter II Date: Fri, 17 Jul 2026 16:13:39 -0700 Subject: [PATCH] test(integration): extend loader-hang workaround to Node 22.0.0 integration-tests/init.spec.js intermittently timed out (30000ms) in the initialize.mjs > as --loader > ... > with DD_INJECTION_ENABLED describe block, with GitHub Actions logging an orphaned node process at job cleanup ("Terminate orphan process"). Reproduced locally on Node 22.0.0: after the spawned child prints its expected output and calls process.exit(), the process leaves behind a live loader hooks worker thread and never exits, so runAndCheckOutput's proc.once('exit', ...) promise never resolves. This is the same class of bug already worked around for Node 20.0.0 (the first minor of the 20.x line to ship module.register's off-thread hooks worker): both 20.0.0 and 22.0.0 are the first patch release of their major line to ship this worker, and both shipped with known process.exit()/exit-propagation bugs in it (nodejs/node#52706, #53097, #53182) that were fixed in later patch releases. Extend setShouldKill's existing grace-period-then-kill workaround to also cover Node 22.0.0, matching the Node 20.0.0 case. --- integration-tests/init.spec.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/integration-tests/init.spec.js b/integration-tests/init.spec.js index cc2bc9f743..db48f6dad2 100644 --- a/integration-tests/init.spec.js +++ b/integration-tests/init.spec.js @@ -278,9 +278,12 @@ describe('init.js', () => { // or on 18.0.0 in particular. if (semver.satisfies(process.versions.node, '>=14.13.1')) { describe('initialize.mjs', () => { - // Node 20.0.0 can leave short-lived loader-based children alive after they - // print the expected output, so terminate them after a short grace period. - setShouldKill(process.versions.node === '20.0.0') + // Node 20.0.0 and 22.0.0 can leave short-lived loader-based children alive after they + // print the expected output, so terminate them after a short grace period. Both are the + // first release of their major line to ship `module.register`'s off-thread hooks worker, + // which had known bugs around `process.exit()` not tearing down the hooks thread + // (e.g. nodejs/node#52706, #53097, #53182) that were fixed in later patch releases. + setShouldKill(['20.0.0', '22.0.0'].includes(process.versions.node)) useSandbox() stubTracerIfNeeded()