node: reap the stdio bridge backend after killing it - #431
Merged
Merged
Conversation
baseService.Teardown killed the command backend's process but nothing ever called Wait, so every torn-down backend stayed a zombie until the node exited. The bridge's stdout reader goroutine now reaps it: it is the only reader of the pipe, so Wait cannot race a read on the pipe it closes, and every exit path (natural exit, crash, Teardown) ends there with an EOF. Pending callers are released before Wait runs so a slow kernel teardown of the child never holds up a request. Teardown treats os.ErrProcessDone as success, since a backend that exited on its own has already been reaped by the time it is torn down.
Contributor
There was a problem hiding this comment.
Code Review
This pull request improves process lifecycle management and cleanup in the node service. Specifically, it ensures that killed command backends are properly reaped by calling Wait() in the StdioBridge to prevent zombie processes, and updates Teardown to ignore os.ErrProcessDone errors when a process has already exited. A new unit test has been added to verify this reaping behavior. No review comments were provided, and the changes align with the repository's testing guidelines.
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.
baseService.Teardown killed the command backend's process but nothing ever called Wait, so every torn-down backend stayed a zombie until the node exited. The bridge's stdout reader goroutine now reaps it: it is the only reader of the pipe, so Wait cannot race a read on the pipe it closes, and every exit path (natural exit, crash, Teardown) ends there with an EOF. Pending callers are released before Wait runs so a slow kernel teardown of the child never holds up a request.
Teardown treats os.ErrProcessDone as success, since a backend that exited on its own has already been reaped by the time it is torn down.