Gilthoniel opened a new issue, #1257: URL: https://github.com/apache/pulsar-client-go/issues/1257
#### Expected behavior Closing a producer should never produce an inconsistent sequence of messages according to Send / SendAsync order of calls. #### Actual behavior When a producer is starting a reconnect loop, and is requested to close at the same time, it can happen that one or more pending batches are dropped and following ones are published. #### Steps to reproduce I can't provide a consistent way of reproducing this because it is very random and rare as you need to get unlucky on the sequence of events. Here is the list of logs that lead me to that discovery: ``` {"ts": "2024-07-23T20:50:42.023Z", "msg": "Closing producer", "producerID": 36} {"ts": "2024-07-23T20:50:42.023Z", "msg": "Connected producer", "producerID": 36, "epoch": 10} {"ts": "2024-07-23T20:50:42.038Z", "msg": "Failing 1 messages on closing producer", "producerID": 36} ``` This is demonstrating the possible race between: ```Go func (p *partitionProducer) doClose(reason error) ``` And ```Go func (p *partitionProducer) grabCnx(assignedBrokerURL string) error ``` #### System configuration **Pulsar version**: v3.0.5 **Pulsar Go client**: v12.1 -- 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: commits-unsubscr...@pulsar.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org