Repository navigation
go: wait for CLI session cmd to finish copying on close - #8940
Merged
Merged
Conversation
I saw the race detector go off in a test run where it appeared to be saying that the Go SDK CLI session code was still finishing an io.Copy to the LogOutput for the test *after* the test was done. That io.Copy was running in an unsynchronized goroutine, so this seems entirely plausible in the case where it is still reading some buffered data from the stderr pipe after the child process exited. This updates the SDK client's Close method to wait for that io.Copy to finish before returning, which should ensure there's no stray writes after Close ends. I couldn't repro this test race locally after many attempts, so this is still a bit of an educated guess. Won't know for sure it's gone until we haven't seen it in CI for a bit. Signed-off-by: Erik Sipsma <[email protected]>
vito
approved these changes
Nov 13, 2024
vito
left a comment
Contributor
There was a problem hiding this comment.
Ha nice I had just started looking for the same thing myself. Thanks! 🙏
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.
I saw the race detector go off in a test run where it appeared to be saying that the Go SDK CLI session code was still finishing an io.Copy to the LogOutput for the test after the test was done.
That io.Copy was running in an unsynchronized goroutine, so this seems entirely plausible in the case where it is still reading some buffered data from the stderr pipe after the child process exited.
This updates the SDK client's Close method to wait for that io.Copy to finish before returning, which should ensure there's no stray writes after Close ends.
I couldn't repro this test race locally after many attempts, so this is still a bit of an educated guess. Won't know for sure it's gone until we haven't seen it in CI for a bit.
Saw the race detector go off here.