shustsud edited a comment on issue #3070:
URL: https://github.com/apache/bookkeeper/issues/3070#issuecomment-1049446938


   @lordcheng10 
   
   readEntryComplete(callback) is run in the 
BookKeeperClientWorker-OrderedExecutor thread.
   ```
   
https://github.com/apache/bookkeeper/blob/525a4a03f99afe1dca120477273537a6db46873c/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerChecker.java#L314
   ```
   
   Then, BookKeeperClientWorker-OrderedExecutor thread acquires the lock of 
semaphore.
   ```
   
https://github.com/apache/bookkeeper/blob/525a4a03f99afe1dca120477273537a6db46873c/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerChecker.java#L323
    -> 
https://github.com/apache/bookkeeper/blob/525a4a03f99afe1dca120477273537a6db46873c/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerChecker.java#L430-L431
     -> 
https://github.com/apache/bookkeeper/blob/525a4a03f99afe1dca120477273537a6db46873c/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerChecker.java#L469
      -> 
https://github.com/apache/bookkeeper/blob/525a4a03f99afe1dca120477273537a6db46873c/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerChecker.java#L208
       -> 
https://github.com/apache/bookkeeper/blob/525a4a03f99afe1dca120477273537a6db46873c/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerChecker.java#L246
       or
       -> 
https://github.com/apache/bookkeeper/blob/525a4a03f99afe1dca120477273537a6db46873c/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerChecker.java#L291
   ```
   
   If all BookKeeperClientWorker-OrderedExecutor threads are waiting to acquire 
the lock, there are no available BookKeeperClientWorker-OrderedExecutor 
threads, so readEntryComplete(callback) will not be run.
   If readEntryComplete(callback) is not run, the lock on semaphore is not 
released, so I think checkAllLedgers gets stuck.
   ```
   
https://github.com/apache/bookkeeper/blob/525a4a03f99afe1dca120477273537a6db46873c/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerChecker.java#L80-L82
   
https://github.com/apache/bookkeeper/blob/525a4a03f99afe1dca120477273537a6db46873c/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerChecker.java#L314-L316
   ```
   
   I think this problem can be reproduced by setting a low value for read 
throttle(inFlightReadEntryNumInLedgerChecker) and also a low value for 
BookKeeperClientWorker-OrderedExecutor(numWorkerThreads?).
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to