Gilthoniel opened a new issue, #1258:
URL: https://github.com/apache/pulsar-client-go/issues/1258

   #### Expected behavior
   
   When calling Flush or FlushWithCtx, previous messages should all be sent.
   
   #### Actual behavior
   
   When flushing, switching to a new channel can lead to a message loss:
   ```Go
        if len(p.dataChan) != 0 {
                oldDataChan := p.dataChan
                p.dataChan = make(chan *sendRequest, 
p.options.MaxPendingMessages)
                for len(oldDataChan) != 0 {
                        pendingData := <-oldDataChan
                        p.internalSend(pendingData)
                }
        }
   ```
   
   If `internalSendAsync` is sending the request to the channel at the same 
time as the switch, it may happen that the length will be zero while flushing, 
and then become one so the message will be stuck in the channel.
   
   #### Steps to reproduce
   
   I never actually observed this in practice but I noticed this bug while 
reading the code for a different issue. I'm confident this can happen but I'd 
like your opinion.
   
   #### System configuration
   **Pulsar version**: v3.0.5
   


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

Reply via email to