-
Notifications
You must be signed in to change notification settings - Fork 55
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: ring buffer deadlock #511
fix: ring buffer deadlock #511
Conversation
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, thanks. Just a couple of nit comments to see if we can tidy up a couple of things.
I have refactored according to the code review from Ben and Dima, and then the final tests with |
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.
Looks good to me, and passes my deadlock tests locally.
Fix an issue where the ring buffer might deadlock because rwlock and iterator mutex are acquired in a different order.
Fixes: #508
Notes:
rb.Write
isn't adjusted because the rwlock and iterator mutex are acquired at different times.close
function, an internalpositions
function is created for the same reason.TestDeadlock
test case anyway.signalIterators
,releaseIterators
andremoveIterator
are adjusted (although technical onlyreleaseIterators
needed to be ) because they share a common naming pattern so it's nicer to share a common implementation pattern as well: all internal functions don't operate locks.Benchmark test, manual test to reproduce the 3-way deadlock issue, and race test are all done and passed.