You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/10/16 11:16:41 UTC

[GitHub] [pulsar] lhotari commented on issue #8229: Broker enters an infinite loop in ManagedLedgerImpl.asyncReadEntries and consumes 100%+ CPU

lhotari commented on issue #8229:
URL: https://github.com/apache/pulsar/issues/8229#issuecomment-709984504


   I've been trying to understand the code more and analyze it. It's not so clear that the problem is in `cursor.hasMoreEntries()` call. 
   
   I added some more columns to the table that I extracted from one of the heap dumps: https://gist.github.com/lhotari/c34db2664b15fc32c9f0e7ae8b37dbda
   
   The goal of this is that when I have the state of the variables in the table, I can manually read the code and debug it like I would have done if I would have had the change to attach a debugger when the broker was in the problematic state.
   
   For example, I added `cursor.ledger.currentLedger.lastAddConfirmed` which is relevant state to understand how the execution keeps on looping.  That is read on this line https://github.com/apache/pulsar/blob/e2fbf31ff34f2aa94276ab6103c73cec23849c1b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L1566. All rows in the extracted table have -1 as cursor.ledger.currentLedger.lastAddConfirmed. therefore, the execution will always go to the branch https://github.com/apache/pulsar/blob/e2fbf31ff34f2aa94276ab6103c73cec23849c1b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L1569
   Within that branch, `opReadEntry.checkReadCompletion()` gets called again and the infinite loop keeps on looping.
   


----------------------------------------------------------------
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.

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