Repository navigation
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 |
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>
bitfield
left a comment
There was a problem hiding this comment.
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.stderrwithout a lock. This PR fixes that by protectingPipe.stderrwithPipe.mu. This PR fixes #193.Testing
Created a simple unit test as follows:
Running
go test -racebefore 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.