Repository navigation
fix(#492): resolve afterEach race condition in MCP integration tests - #493
Merged
Merged
Conversation
The afterEach cleanup checked proc.exitCode and proc.killed to detect already-exited processes, but signal-killed processes have exitCode=null and killed=false (process.kill(-pid) doesn't set killed). This caused the exit listener to be registered after the event had already fired, resulting in a promise that never resolved and a 60s timeout. Fix: check proc.signalCode !== null in the early-exit condition, and add a 5s timeout fallback on the exit promise as belt-and-suspenders. Fixes #492 Entire-Checkpoint: bb61dc5abe0c
Same signalCode check + timeout fix as the other two MCP integration test files. Found during QA sweep for identical vulnerable patterns. Entire-Checkpoint: f138b7c866fc
4 tasks
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.
Summary
afterEachcleanup across 3 MCP integration test files where signal-killed processes haveexitCode=nullandkilled=false, causing the exit listener to never fire and a 60s timeout hangproc.signalCode !== nullto the early-exit check + 5s timeout fallback on exit promisemcp-serve-multi-client.integration.test.ts(found during QA sweep)Root Cause
When
process.kill(-pid, signal)kills a process group, Node.js setssignalCodebut leavesexitCode=nullandkilled=false. The old code only checkedexitCodeandkilled, missed the already-exited process, registered anexitlistener after the event had already fired, and hung for 60s.Test plan
Fixes #492