You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2021/12/24 09:21:47 UTC

[GitHub] [bookkeeper] kezhuw opened a new pull request #2962: Fix Journal.ForceWriteThread.forceWriteRequests.put deadlock

kezhuw opened a new pull request #2962:
URL: https://github.com/apache/bookkeeper/pull/2962


   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: #2948


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] dlg99 commented on pull request #2962: Fix Journal.ForceWriteThread.forceWriteRequests.put deadlock

Posted by GitBox <gi...@apache.org>.
dlg99 commented on pull request #2962:
URL: https://github.com/apache/bookkeeper/pull/2962#issuecomment-1004428932


   also please fix checkstyle error:
   ```
   [ERROR] /home/runner/work/bookkeeper/bookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java:513: Line is longer than 120 characters (found 143). [LineLength]
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] dlg99 merged pull request #2962: Fix Journal.ForceWriteThread.forceWriteRequests.put deadlock

Posted by GitBox <gi...@apache.org>.
dlg99 merged pull request #2962:
URL: https://github.com/apache/bookkeeper/pull/2962


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] kezhuw commented on pull request #2962: Fix Journal.ForceWriteThread.forceWriteRequests.put deadlock

Posted by GitBox <gi...@apache.org>.
kezhuw commented on pull request #2962:
URL: https://github.com/apache/bookkeeper/pull/2962#issuecomment-1008497486


   @dlg99 I have pushed fixup commits to solve your concerns, could you please take another look ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] dlg99 commented on a change in pull request #2962: Fix Journal.ForceWriteThread.forceWriteRequests.put deadlock

Posted by GitBox <gi...@apache.org>.
dlg99 commented on a change in pull request #2962:
URL: https://github.com/apache/bookkeeper/pull/2962#discussion_r777747292



##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
##########
@@ -509,7 +510,7 @@ public void run() {
                             // queue will benefit from this force write - post a marker prior to issuing
                             // 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));

Review comment:
       consider logging and incrementing a counter (for monitoring/alerting/troubleshooting) if forceWriteMarkerSent is false.

##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
##########
@@ -509,7 +510,7 @@ public void run() {
                             // queue will benefit from this force write - post a marker prior to issuing
                             // 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));

Review comment:
       createForceWriteRequest uses pool; if offer failed we need to recycle the request to avoid leak.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [bookkeeper] dlg99 commented on pull request #2962: Fix Journal.ForceWriteThread.forceWriteRequests.put deadlock

Posted by GitBox <gi...@apache.org>.
dlg99 commented on pull request #2962:
URL: https://github.com/apache/bookkeeper/pull/2962#issuecomment-1018098893


   @eolivelli @Vanlightly FYI


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@bookkeeper.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org