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 2021/08/23 07:40:51 UTC

[GitHub] [pulsar] lhotari commented on a change in pull request #11737: Fix the topic in fenced state and can not recover.

lhotari commented on a change in pull request #11737:
URL: https://github.com/apache/pulsar/pull/11737#discussion_r693734024



##########
File path: managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java
##########
@@ -179,7 +179,16 @@ public void addComplete(int rc, final LedgerHandle lh, long entryId, Object ctx)
     public void safeRun() {
         // Remove this entry from the head of the pending queue
         OpAddEntry firstInQueue = ml.pendingAddEntries.poll();
-        checkArgument(this == firstInQueue);
+        if (firstInQueue == null) {
+            // The pending op might been polled by others such as cleanup pending op when create Ledger failed.
+            this.recycle();
+            return;
+        }
+        if (this != firstInQueue) {
+            firstInQueue.failed(new ManagedLedgerException("Unexpected add entry op when complete the add entry op."));
+            this.recycle();
+            return;
+        }

Review comment:
       How about `ReferenceCountUtil.release(data);` in these cases? would that be needed to prevent memory leaks? `this.recycle` doesn't handle releasing of `data`.




-- 
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: commits-unsubscribe@pulsar.apache.org

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