YinY1 commented on issue #25145:
URL: https://github.com/apache/pulsar/issues/25145#issuecomment-3754194616

   > I haven't checked it yet, but there's a possibility that the test code 
contains a race condition with the `receiptTracker` handling.
   > You can remove `if (receipts != null) {` in the consumer task logic to 
find out. It would be null if there's a race condition.
   > 
   > To fix the race condition, I'd recommend extracting a method for getting 
the receipt tracker and use something like 
`receiveTracker.computeIfAbsent(messageId, __ -> 
ConcurrentHashMap.newKeySet())`.
   > 
   > 
   > 
   > 
   > 
   
   I'm sorry about my mistake in this demo. Because of the complexity of the 
the actual production code, I did not copy the code direcetly but rewrote a 
test demo without a careful check.
   
   Indeed I do use `computeIfAbsent` and other thread safe methods in my code, 
I will correct this test demo ASAP.
   
   This bug is so rare that during testing I produce and consume 100,000 
messages per iteration; sometimes it can be reproduced within five test cycles, 
while other times it cannot be reproduced even after more than ten cycles.
   
   Thanks for your patience again!


-- 
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]

Reply via email to