-
-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(race-conditon): fix data race condition when accessing stderr
on pipe
#209
Conversation
question: we currently do not run |
If we can have race conditions, we should definitely run CI tests with the race detector on! |
Added the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good so far!
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
@mahadzaryab1 I'm happy if you're happy—do you want to go ahead and do a final quality pass, checking documentation comments, alphabetical order, |
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
@bitfield Done! Let me know if there's anything I missed. |
Signed-off-by: Mahad Zaryab <mahadzaryab1@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nice, @mahadzaryab1! Thanks a lot. I'll wait till you're done on #208, and then we can roll all these changes up into a new release.
There was a race condition that existed in
Pipe.Exec
, which spins up a goroutine that accessPipe.stderr
without a lock. This PR fixes that by protectingPipe.stderr
withPipe.mu
. This PR fixes #193.Testing
Created a simple unit test as follows:
Running
go test -race
before the changes in this PR outputted the same warning seen in the issue. Running it again with the changes in the PR cause the tests to pass.