Skip to content

Commit

Permalink
Fix the deadlock while using zookeeper thread to create ledger (apach…
Browse files Browse the repository at this point in the history
…e#13744)

### Motivation

Fixes: apache#13736, the deadlock when using ZK thread to create a ledger.

### Modification

Use the executor of the managed ledger to create the ledger to avoid the deadlock.

(cherry picked from commit 1d4c374)
(cherry picked from commit d7117fb)
  • Loading branch information
codelipenghui authored and lhotari committed Jan 20, 2022
1 parent 01bc5d6 commit 4c25e83
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -1586,7 +1586,10 @@ synchronized void createLedgerAfterClosed() {
STATE_UPDATER.set(this, State.CreatingLedger);
this.lastLedgerCreationInitiationTimestamp = System.currentTimeMillis();
mbean.startDataLedgerCreateOp();
asyncCreateLedger(bookKeeper, config, digestType, this, Collections.emptyMap());
// Use the executor here is to avoid use the Zookeeper thread to create the ledger which will lead
// to deadlock at the zookeeper client, details to see https://github.com/apache/pulsar/issues/13736
this.executor.execute(() ->
asyncCreateLedger(bookKeeper, config, digestType, this, Collections.emptyMap()));
}
}

Expand Down

0 comments on commit 4c25e83

Please sign in to comment.