pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] massakam opened a new pull request #2973: Fix NPE caused by the race condition
Date Sun, 11 Nov 2018 16:00:52 GMT
massakam opened a new pull request #2973: Fix NPE caused by the race condition
URL: https://github.com/apache/pulsar/pull/2973
 
 
   ### Motivation
   
   There is a possibility that NPE occurs in `ManagedLedgerImpl#deactivateCursor()`.
   
   A thread checks whether `activeCursors` is empty on L2614. If `activeCursors` is not empty,
`activeCursors.getSlowestReader().getReadPosition()` will be called on line L2621. However,
another thread may remove a cursor from `activeCursors` in the meantime. If `activeCursors`
becomes empty, `activeCursors.getSlowestReader()` returns null and NPE is thrown.
   https://github.com/apache/pulsar/blob/d5e88c1ec16df557655e42c9f648a2fd3343d759/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L2611-L2624
   
   As a result, closing of the `PersistentTopic` does not complete normally, and the fenced
topic is left.
   
   ### Modifications
   
   Make `ManagedLedgerImpl#deactivateCursor()` synchronized.
   
   ### Result
   
   Fixes https://github.com/apache/pulsar/issues/2967

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

Mime
View raw message