poorbarcode opened a new pull request, #24366:
URL: https://github.com/apache/pulsar/pull/24366
### Motivation
Reproduction steps of the deadlock
1. `thread-compaction`: create a raw reader.
2. `thread-topic-deleting`: mark the topic as deleted and disconnect
clients, including the compaction reader.
3. `thread-compaction`: The raw reader attempts to reconnect due to the
disconnection in step "2-1".
4. `thread-topic-deleting`: unsubscribe all subscriptions that contain
"__compaction".
5. `thread-topic-deleting`: deleting "__compaction" cursor will wait for the
in-progress compaction task.
6. `thread-compaction`: the raw read can not connect successfully anymore
because the topic was marked as "fenced && isDeleting".
7. `deadlock`: "thread-topic-deleting" waiting for compaction task being
finished, thread-compaction continuously reconnects.
Note:
- If the `thread-compaction` is stuck when the first phase of compaction
calling `reader.readNextAsync()` at step 6, the deadlock can be solved after
`{brokerServiceCompactionPhaseOneLoopTimeInSeconds)` seconds
- But regarding other scenarios, such as `reader.getLastMessageIdAsync`...
the deadlock will persist forever.
### Modifications
To solve the issue, let "thread-topic-deleting" release the
`fencing&deleting` state, and wait for the compaction task to finish. Since
"thread-topic-deleting" never releases "lock.writeLock", the broker will not
trigger a new compaction task.
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update
later -->
- [x] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
### Matching PR in forked repository
PR in forked repository: x
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]