Skip to content

java.lang.IllegalArgumentException: ledgerId doesn't match with acked ledgerId #5588

Closed

Description

@sijie

Describe the bug

Broker throws IllegalArgumentException on write failures.

java.lang.IllegalArgumentException: ledgerId 40 doesn't match with acked ledgerId 39
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:323) ~[com.google.guava-guava-21.0.jar:?]
        at org.apache.bookkeeper.mledger.impl.OpAddEntry.addComplete(OpAddEntry.java:116) ~[org.apache.pulsar-managed-ledger-original-2.4.1.jar:2.4.1]
        at org.apache.bookkeeper.client.AsyncCallback$AddCallback.addCompleteWithLatency(AsyncCallback.java:91) ~[org.apache.bookkeeper-bookkeeper-server-4.9.2.jar:4.9.2]
        at org.apache.bookkeeper.client.PendingAddOp.submitCallback(PendingAddOp.java:390) ~[org.apache.bookkeeper-bookkeeper-server-4.9.2.jar:4.9.2]
        at org.apache.bookkeeper.client.LedgerHandle.errorOutPendingAdds(LedgerHandle.java:1772) ~[org.apache.bookkeeper-bookkeeper-server-4.9.2.jar:4.9.2]
        at org.apache.bookkeeper.client.LedgerHandle$5.safeRun(LedgerHandle.java:572) ~[org.apache.bookkeeper-bookkeeper-server-4.9.2.jar:4.9.2]
        at org.apache.bookkeeper.common.util.SafeRunnable.run(SafeRunnable.java:36) [org.apache.bookkeeper-bookkeeper-common-4.9.2.jar:4.9.2]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_222]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_222]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [io.netty-netty-all-4.1.32.Final.jar:4.1.32.Final]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]

To Reproduce

Has seen this behavior on several stress tests.

Expected behavior

No exception throw during stress tests.

Additional context

The problem was introduced because we reuse OpAddEntry between two different ledgers.

  1. when a ledger fails to write an entry, the ledger is closed. but we didn't clear pendingAddEntries in managed ledger. (https://github.com/apache/pulsar/blob/master/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java#L228)
  2. when a new ledger is opened, the pendingAddEntries will be re-sent by setting to the new ledger handle. (https://github.com/apache/pulsar/blob/master/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L1299)

If the callback of an OpAddEntry is triggered after the op is already re-sent to the new ledger, it will check if the ledger id in the callback is same as the ledger id in the OpAddEntry is same. If the ledger doesn't match, it will throw IllegalArgumentException (https://github.com/apache/pulsar/blob/master/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpAddEntry.java#L179)

Since we are using recycler for managing OpAddEntry, we should avoid using same ops between different ledger handles.

Activity

  1. added
    type/bug
    on Nov 7, 2019
  2. added this to the milestone on Nov 7, 2019
  3. self-assigned this
    on Nov 7, 2019
  4. modified the milestones: , 2.6.0 on Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/brokerrelease/2.5.1type/bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions