lhotari commented on a change in pull request #10755:
URL: https://github.com/apache/pulsar/pull/10755#discussion_r642803038
##########
File path:
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java
##########
@@ -178,8 +178,21 @@ public void addComplete(int rc, final LedgerHandle lh,
long entryId, Object ctx)
@Override
public void safeRun() {
// Remove this entry from the head of the pending queue
- OpAddEntry firstInQueue = ml.pendingAddEntries.poll();
- checkArgument(this == firstInQueue);
+ OpAddEntry firstInQueue = ml.pollPendingAddEntry();
+ if (this != firstInQueue) {
+ log.warn("Expected OpAddEntry wasn't first in queue. expected={}
actual={}", this, firstInQueue);
+ ManagedLedgerException managedLedgerException =
+ new ManagedLedgerException("Expected OpAddEntry wasn't
first in queue.");
+ // fail both entries
+ try {
+ if (firstInQueue != null) {
+ firstInQueue.failed(managedLedgerException);
+ }
+ } finally {
+ failed(managedLedgerException);
Review comment:
@devinbost if the arguments get rejected and one of the argument is a
[Netty reference counted
object](https://netty.io/wiki/reference-counted-objects.html), it would cause a
memory leak if the called method is responsible for releasing the object.
--
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:
[email protected]