-
Notifications
You must be signed in to change notification settings - Fork 131
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 in zk library #35
base: master
Are you sure you want to change the base?
Conversation
Can you add a test to show the race and the now fixed situation. |
I cannot. The issue popped up occasionally, though rarely, in our tests of github.com/fullstorydev/gosolr. That repo contains a solrmonitor package which makes it easy to write solr clients that want to stay in sync with the cluster topology in Zookeeper, for optimal request routing. We run those tests with
The version of the library used in the test at this time was 6f3354f. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #35 +/- ##
==========================================
+ Coverage 75.94% 77.20% +1.26%
==========================================
Files 7 7
Lines 1193 1316 +123
==========================================
+ Hits 906 1016 +110
- Misses 196 209 +13
Partials 91 91 ☔ View full report in Codecov by Sentry. |
We created this fork as there was a number of changes that weren't being upstreamed even after contacting samuel. Since then samuel has accepted some pull requests, but I think the two libraries will start diverging a bit here and there. The advantage here is there is no "one" owner so hopefully we can keep the support going. However we won't be hurt if you did a PR there as well. :) |
Although we should try to recreate this somehow even if it is very synthetic. I am partially worried that just wrapping everything in atomic values is a bit of a bandaid. |
Is it still happening with the latest release? |
We can try to put together a test case, to mechanically repro, but honestly it's easier to simply prove the data race by code inspection on this section of wg.Add(1)
go func() {
defer close(c.closeChan) // tell send loop to exit
defer wg.Done()
var err error
if c.debugCloseRecvLoop {
err = errors.New("DEBUG: close recv loop")
} else {
err = c.recvLoop(c.conn)
}
if err != io.EOF || c.logInfo {
c.logger.Printf("recv loop terminated: %v", err)
}
if err == nil {
panic("zk: recvLoop should never return nil error")
}
}()
c.sendSetWatches()
wg.Wait()
|
We found a race condition in the code and this was a fix we applied internally. Hoping we can get this patch upstreamed.
This repo looks more active than the original (samuel/go-zookeeper). Are you the new maintainers of this library?