child_process: clear timeout timer on spawn error - #65929
Conversation
A spawn failure emits 'error' without 'exit', so a timeout timer cleared only on 'exit' stayed armed and kept the event loop alive for the whole timeout. Clear it on 'close', which is emitted in both cases, as exec() already does. Fixes: nodejs#65504 Signed-off-by: Avocado <ujubongbong@gmail.com>
|
Welcome to Node.js, and thank you for your first contribution! Before review, please take a moment to read:
Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal. Caution AgentScan found account activity patterns that may be consistent with automation. This is a heuristic, not proof that this pull request was opened by an agent or violates policy. AI-assisted contributions are permitted, but automated tooling must not open pull requests without advance approval, and contributors must personally understand, test, verify, and take responsibility for every submitted change. See the AgentScan analysis, AI use policy, and automation policy for additional context. |
|
Duplicate of #65506 |
|
Sorry for the noise, I missed #65506 when checking for existing work. Closing it. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #65929 +/- ##
==========================================
+ Coverage 90.17% 90.19% +0.02%
==========================================
Files 771 771
Lines 265407 265451 +44
Branches 50441 50460 +19
==========================================
+ Hits 239322 239416 +94
+ Misses 17029 16986 -43
+ Partials 9056 9049 -7
🚀 New features to boost your workflow:
|
spawn()with atimeouthangs for the full timeout when the child fails to spawn.The timer is cleared on
'exit', but a spawn failure getsexitCode < 0inonexitand emits'error'instead, so the timer stays armed and holds the event loop open.'close'is emitted in both cases, andexec()already clears its timer from both'close'and'error'. Switching the listener to'close'covers the failure path without changing the success path.The added test asserts on
process.getActiveResourcesInfo()rather than elapsed time, so it does not depend on timing.Fixes: #65504