You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
I think that what happens is that the producer is in reconnect loop and during that time we are accumulating sending requests and a close request. After successfully reconnecting, the close will eventually be processed but it only closes the channel so remaining sending requests can be written to the connection, in parallel of the producer closing (different channels in the client).
In the logs above, we can assume one sending request went through and has been dropped later on by the close but then at least one message has been written to the connection and successfully published in the broker.
From what I can see, closing does not actually prevent further messages to go through because closing the producer is done on a different channel:
The text was updated successfully, but these errors were encountered:
Gilthoniel
changed the title
Incorrect sequence of messages due to a race between reconnect and close in producer
Incorrect sequence of messages while reading dataChan after closing
Jul 26, 2024
@gunli Yes I think that's enough to avoid this situation. Please note that using a context like #1249 is not really what context is intended to and that should be handled via a channel.
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:
I think that what happens is that the producer is in reconnect loop and during that time we are accumulating sending requests and a close request. After successfully reconnecting, the close will eventually be processed but it only closes the channel so remaining sending requests can be written to the connection, in parallel of the producer closing (different channels in the client).
In the logs above, we can assume one sending request went through and has been dropped later on by the close but then at least one message has been written to the connection and successfully published in the broker.
From what I can see, closing does not actually prevent further messages to go through because closing the producer is done on a different channel:
System configuration
Pulsar version: v3.0.5
Pulsar Go client: v12.1
The text was updated successfully, but these errors were encountered: