-
Notifications
You must be signed in to change notification settings - Fork 963
Fix Journal.ForceWriteThread.forceWriteRequests.put deadlock #2962
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 Journal.ForceWriteThread.forceWriteRequests.put deadlock #2962
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.
Looks good but can leak memory AFAICT and needs some observability.
| // the flush so until this marker is encountered we can skip the force write | ||
| if (enableGroupForceWrites) { | ||
| forceWriteRequests.put(createForceWriteRequest(req.logFile, 0, 0, null, false, true)); | ||
| forceWriteMarkerSent = forceWriteRequests.offer(createForceWriteRequest(req.logFile, 0, 0, null, false, true)); |
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.
consider logging and incrementing a counter (for monitoring/alerting/troubleshooting) if forceWriteMarkerSent is false.
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.
createForceWriteRequest uses pool; if offer failed we need to recycle the request to avoid leak.
|
also please fix checkstyle error: |
…WriteRequests.put
a050531 to
4365c30
Compare
|
@dlg99 I have pushed fixup commits to solve your concerns, could you please take another look ? |
dlg99
left a comment
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, thank you!
let's wait for the CI results + someone else to review.
Descriptions of the changes in this PR: ### Motivation `Journal.ForceWriteThread` could deadlock as it is the sole consumer of `Journal.forceWriteRequests` while it send group marker blocking using `BlockingQueue.put`. This PR try to fix this. ### Changes * Add testing code to deadlock `Journal.ForceWriteThread` on `forceWriteRequests.put`. * Send force write group marker non-blocking to avoid deadlock `ForceWriteThread`. Master Issue: apache#2948 Reviewers: Andrey Yegorov <None> This closes apache#2962 from kezhuw/fix-Journal.ForceWriteThread.forceWriteRequests.put-deadlock (cherry picked from commit 1b1e937)
…e request !7) Cherry pick 4.15 bug changes to repo 1. cherry pick some 4.15.0 changes - apache#2962 - apache#2836 2. Bump new bookie version to 4.14.4.220419-SNAPSHOT
…equently forceWrite (#3454) Fix group ForceWrite not take effect with forceWriteMarkerSent in while loop of ForceWriteThread ### Motivation Bookkeeper 4.15 has performance issue. There are too many journal sync. Then I found in ForceWriteThread, forceWriteMarkerSent is reset to false for every loop, and this can cause shouldForceWrite=true and trigger journal sync. This new logic is bringed by #2962 ### Changes move forceWriteMarkerSent=false out of while loop.
…equently forceWrite (#3454) Fix group ForceWrite not take effect with forceWriteMarkerSent in while loop of ForceWriteThread ### Motivation Bookkeeper 4.15 has performance issue. There are too many journal sync. Then I found in ForceWriteThread, forceWriteMarkerSent is reset to false for every loop, and this can cause shouldForceWrite=true and trigger journal sync. This new logic is bringed by #2962 ### Changes move forceWriteMarkerSent=false out of while loop. (cherry picked from commit dcc9a41)
Descriptions of the changes in this PR: ### Motivation `Journal.ForceWriteThread` could deadlock as it is the sole consumer of `Journal.forceWriteRequests` while it send group marker blocking using `BlockingQueue.put`. This PR try to fix this. ### Changes * Add testing code to deadlock `Journal.ForceWriteThread` on `forceWriteRequests.put`. * Send force write group marker non-blocking to avoid deadlock `ForceWriteThread`. Master Issue: apache#2948 Reviewers: Andrey Yegorov <None> This closes apache#2962 from kezhuw/fix-Journal.ForceWriteThread.forceWriteRequests.put-deadlock
…equently forceWrite (apache#3454) Fix group ForceWrite not take effect with forceWriteMarkerSent in while loop of ForceWriteThread ### Motivation Bookkeeper 4.15 has performance issue. There are too many journal sync. Then I found in ForceWriteThread, forceWriteMarkerSent is reset to false for every loop, and this can cause shouldForceWrite=true and trigger journal sync. This new logic is bringed by apache#2962 ### Changes move forceWriteMarkerSent=false out of while loop.
Descriptions of the changes in this PR:
Motivation
Journal.ForceWriteThreadcould deadlock as it is the sole consumer ofJournal.forceWriteRequestswhile it send group marker blocking usingBlockingQueue.put.This PR try to fix this.
Changes
Journal.ForceWriteThreadonforceWriteRequests.put.ForceWriteThread.Master Issue: #2948