poorbarcode commented on PR #21134:
URL: https://github.com/apache/pulsar/pull/21134#issuecomment-1707038520

   @michaeljmarshall 
   
   > As far as I can tell, messages are not actually removed from 
pendingMessages until they are ack'd, timedout, or get an error from the broker.
   
   After I recheck the code, you are right, it will not be removed in the 
method `ProducerImpl.recoverProcessOpSendMsgFrom`.
   
   > Is it possible to set up a test to show that this is true?
   
   I also think this is a good way to confirm the issue. But it is hard to 
reproduce. I tend to think you're right, these messages will be re-sent and a 
response will be received if the time is enough.
   
   > Also, note that there is synchronization on the ProducerImpl. this object 
that is intended to prevent certain race conditions.
   
   Yes, `timeout task` and `handle send receipt` acquire the same lock 
`ProducerImpl.this`, but each time they process a message, they acquire and 
release the lock, so the scenario below might occur:
   - `msg1 send` timeout, acquire the lock, and release the lock, the user gets 
a timeout error for the `msg1`.
   - receive a response of `msg2 send` from the broker, the user gets a success 
sending `msg2`.
   - `msg3 send` timeout, acquire the lock, and release the lock, the user gets 
a timeout error for the `msg3`.
   - receive a response of `msg2 send` from the broker, the user gets a success 
sending `msg4`.


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