fix(e2e): send SIGINT on teardown to prevent orphan processes#785
Open
doringeman wants to merge 1 commit intomainfrom
Open
fix(e2e): send SIGINT on teardown to prevent orphan processes#785doringeman wants to merge 1 commit intomainfrom
doringeman wants to merge 1 commit intomainfrom
Conversation
Signed-off-by: Dorin Geman <dorin.geman@docker.com>
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider making the custom Cancel function resilient to being invoked before the process has started (e.g., checking server.Process != nil before signaling) to avoid potential nil pointer issues if the context is canceled early.
- You may want to add a follow-up mechanism to escalate from os.Interrupt to a Kill after a timeout if the server fails to shut down gracefully, to avoid tests hanging indefinitely on a stuck child process.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider making the custom Cancel function resilient to being invoked before the process has started (e.g., checking server.Process != nil before signaling) to avoid potential nil pointer issues if the context is canceled early.
- You may want to add a follow-up mechanism to escalate from os.Interrupt to a Kill after a timeout if the server fails to shut down gracefully, to avoid tests hanging indefinitely on a stuck child process.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a graceful shutdown mechanism for the server process in e2e tests by setting the server.Cancel function to send an os.Interrupt signal. However, the current implementation will cause issues on Windows, leading to orphan processes, as os.Interrupt is not supported on that platform. The feedback suggests adding a runtime check to use server.Process.Kill() for Windows and os.Interrupt for other operating systems to ensure correct behavior across all platforms.
ilopezluna
approved these changes
Mar 24, 2026
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.
The e2e test teardown was using exec.CommandContext which sends SIGKILL when the context is cancelled. This kills the model-runner server instantly without giving it a chance to shut down its child processes (llama.cpp, vllm-metal), leaving orphan processes running on their ports. Setting Cmd.Cancel to send os.Interrupt instead triggers the same graceful shutdown path as Ctrl+C, which properly cleans up all backend processes.
Note that os.Interrupt is not supported on Windows , so a platform-specific mechanism will be needed when Windows e2e tests are added.