-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Workaround race condition in printing of diff values. #1229
Conversation
+1 to this PR. I'm pretty sure I just ran into this today |
Thanks for the patch! Fixed the problem for me. Any chance we can get this draft finished and merged? I'd be glad to help with this. /cc @dokterbob @boyan-soubachov |
9ebebef
to
82be843
Compare
@palkan @boyan-soubachov @devosnw Thanks for the feedback and sorry it took quite a while. I've rebased to master, let's see what the tests reveal. |
So, this is the output I'm getting:
The first errors seem more a matter of aesthetics, I guess it would be possible to use a conditional there - e.g The latter errors really do seem to relate something functional. But I'm not into the code enough to figure out what with the limited time I have available. If somebody feels like continuing my work to get some variant of this merged that'd be 👍🏼 as I'm basically stuck for time. Note that I also added a regression test with 82be843. I am not 100% sure it's correct, I discovered I had it lying around and never pushed it. |
Caused by issue described in stretchr/testify#1229. The workaround here is to close out the session in the same goroutine as handleNewConnection. This actually simplifies the code by reducing the # of goroutines per connection by 1 and allowing the unit tests to synchronize without a waitgroup.
Caused by issue described in stretchr/testify#1229. The workaround here is to close out the session in the same goroutine as handleNewConnection. This actually simplifies the code by reducing the # of goroutines per connection by 1 and allowing the unit tests to synchronize without a waitgroup.
Caused by issue described in stretchr/testify#1229. The workaround here is to close out the session in the same goroutine as handleNewConnection. This actually simplifies the code by reducing the # of goroutines per connection by 1 and allowing the unit tests to synchronize without a waitgroup.
Caused by issue described in stretchr/testify#1229. The workaround here is to close out the session in the same goroutine as handleNewConnection. This actually simplifies the code by reducing the # of goroutines per connection by 1 and allowing the unit tests to synchronize without a waitgroup.
Closing because replaced by #1598. |
Summary
When a pointer argument is used in
Run()
and this object is modified in an asynchronous fashion, the evaluation of%v
inArguments.Diff
causes a race condition.Example output
Relevant code
https://github.com/ipfs-search/ipfs-search/blob/fix_race_condition/components/crawler/crawler_test.go#L1040
Changes
Replaced
%v
by%p
, inspired by 6241f9a.Motivation
We need to test for race conditions in our code, not the testing library. ;)
This is a workaround and should not be seen as a full fix. It is also lacking regression tests and causes existing tests to fail. Regrettably, I currently lack bandwith to provide them.
Related issues
#125