fix: prevent unbounded wait during pipe listener close - #364
Closed
Kiell Tampubolon (glatinone) wants to merge 2 commits into
Closed
fix: prevent unbounded wait during pipe listener close#364Kiell Tampubolon (glatinone) wants to merge 2 commits into
Kiell Tampubolon (glatinone) wants to merge 2 commits into
Conversation
…leak makeConnectedServerPipe previously blocked indefinitely on <-ch after Close() aborted a pending ConnectNamedPipe, with no bound on how long that wait could take. Add a bounded 100ms drain so Close() returns promptly even if the underlying I/O completion is delayed. The connect goroutine's result channel was unbuffered, so abandoning the wait after the timeout would leak that goroutine forever on its blocking send. Buffer the channel (capacity 1) so the goroutine can always deliver its result and exit cleanly regardless of whether anyone is still listening. Adds TestListenerCloseDuringPendingConnectReturnsPromptly and a windows-latest GitHub Actions workflow to verify it on a real Windows runner. Signed-off-by: glatinone <93207632+glatinone@users.noreply.github.com>
golangci-lint's errorlint check flagged the direct != comparison against ErrPipeListenerClosed in the new test. Use errors.Is to match repository convention and satisfy the zero-tolerance lint gate in .golangci.yml. Signed-off-by: glatinone <93207632+glatinone@users.noreply.github.com>
Author
|
@microsoft-github-policy-service agree |
Author
|
Closing this PR to avoid adding unnecessary review overhead for maintainers. Thank you for your time! |
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.
Description
Addresses a potential unbounded shutdown hang in
win32PipeListener.Close().Technical Changes
err = <-chinside thecase <-l.closeCh:block with a bounded select statement utilizing a 100-millisecond timeout guard viatime.After.make(chan error, 1)) to guarantee the background connection goroutine can complete its write and exit cleanly after a timeout event, preventing runtime goroutine leaks.pipe_test.goto verify bounded execution windows during concurrent listener termination.Verification
Validated successfully on a remote
windows-latestcloud runner.