-
Notifications
You must be signed in to change notification settings - Fork 905
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
Fixed locking of PendingAddOp #3806
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3806 +/- ##
============================================
+ Coverage 60.47% 68.31% +7.83%
- Complexity 5847 6744 +897
============================================
Files 473 473
Lines 40933 40934 +1
Branches 5235 5235
============================================
+ Hits 24756 27965 +3209
+ Misses 13976 10712 -3264
- Partials 2201 2257 +56
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
Usually these methods are always called on the same thread.
Adding synchronized under this assumptium shouldn't add much cost (no actual contention) so I am fine with the patch.
I wonder if you found out which is the activity who accesses this object outside of the assigned ML thread
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.
Forget my last comment
LGTM
@@ -358,7 +358,7 @@ public synchronized void writeComplete(int rc, long ledgerId, long entryId, Book | |||
} else { | |||
LOG.warn("Failed to write entry ({}, {}) to bookie ({}, {}): {}", | |||
ledgerId, entryId, bookieIndex, addr, BKException.getMessage(rc)); | |||
lh.handleBookieFailure(ImmutableMap.of(bookieIndex, addr)); | |||
lh.executeOrdered(() -> lh.handleBookieFailure(ImmutableMap.of(bookieIndex, addr))); |
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.
We shouldn't change the thread here, it will delay the handleBookieFailure process. Please check the failed test LedgerClose2Test#testMetadataChangedDuringClose
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.
Gotcha!
Good job! |
* Fixed locking of PendingAddOp * Fixed stack overflow * Fixed stack overflow in different point
Motivation
Fix #3805
The test was failing because the updates to the object, done in the
initiate()
method, were not immediately visible to other threads. We must use synchronized consistently in all the accesses.