[Bug] SnapshotSegmentAbortedTxnProcessorImpl contains thread safety issues
- Dominant language
- Java
- Stars
- 15.3k
- Forks
- 3.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 160
Description
### Search before asking
- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
### Version
master
### Minimal reproduce step
There are several thread safety issues in SnapshotSegmentAbortedTxnProcessorImpl class.
examples:
https://github.com/apache/pulsar/blob/529e1ab80998143cfe793c018429e9d2bbee5473/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/SnapshotSegmentAbortedTxnProcessorImpl.java#L374-L376
https://github.com/apache/pulsar/blob/529e1ab80998143cfe793c018429e9d2bbee5473/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/SnapshotSegmentAbortedTxnProcessorImpl.java#L383
https://github.com/apache/pulsar/blob/529e1ab80998143cfe793c018429e9d2bbee5473/pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/SnapshotSegmentAbortedTxnProcessorImpl.java#L744
### What did you expect to see?
Multi-threading code should be thread safe.
### What did you see instead?
Non thread-safe code.
### Anything else?
_No response_
### Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
Contributor guide
Research direction
Start by reading pulsar-broker/src/main/java/org/apache/pulsar/broker/transaction/buffer/impl/SnapshotSegmentAbortedTxnProcessorImpl.java, focusing on the referenced lines 374-376, 383, and 744. Trace how these sections are reached concurrently and identify the expected synchronization behavior. Done means the reported thread-safety issues are resolved and verified with appropriate multithreaded regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100