Skip to content

Commit

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

Fixes: #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.
  • Loading branch information
codelipenghui committed Jan 14, 2022
1 parent a255992 commit 1d4c374
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -1638,7 +1638,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 1d4c374

Please sign in to comment.