-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix an issue where the ring buffer might deadlock because rwlock and iterator mutex are acquired in a different order. Fixes: #508 Notes: 1. As discussed with Harry and Ben, `rb.Write` isn't adjusted because the rwlock and iterator mutex are acquired at different times. 2. Besides an internal `close` function, an internal `positions` function is created for the same reason. 3. The [test case here](#508 (comment)) is not added because it was supposed to be an easy way to reproduce the deadlock. Adding an additional benchmark test is not useful, and the deadlock issue can be caught by the `TestDeadlock` test case anyway. 4. All three functions `signalIterators`, `releaseIterators` and `removeIterator` are adjusted (although technical only `releaseIterators` 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.
- Loading branch information
1 parent
c3cb594
commit ae91836
Showing
2 changed files
with
13 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters