-
Notifications
You must be signed in to change notification settings - Fork 493
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
network: fix peerstore Get/Put races #6261
network: fix peerstore Get/Put races #6261
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6261 +/- ##
==========================================
- Coverage 51.80% 50.18% -1.62%
==========================================
Files 644 644
Lines 86643 86644 +1
==========================================
- Hits 44886 43484 -1402
- Misses 38887 40219 +1332
- Partials 2870 2941 +71 ☔ View full report in Codecov by Sentry. |
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.
OK, big lock is easier for reader to understand, LGTM!
Summary
Fix for a race condition seen in this test run
peerstore's
GetConnectionWaitTime
gets a peerstore entry, calculates number ofrecentConnectionTimes
to remove and then callspopNElements
that also gets the same entry from peerstore and attempts to remove number of entries calculated on the first copy.Fixed by removing the
addressData
mutex and adding it toPeerStore
itself. Otherwise all thesePeerStore
methods are racy.Test Plan
Existing tests