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

   #### Expected behavior
   
   write calls of one connection should be sequential
   
   #### Actual behavior
   
   write calls of one connection are invoked in 2 goroutine, which may lead to 
data/write conflict
   
   #### Steps to reproduce
   
   Code review:
   ```go
   go func() {
                for {
                        select {
                        case <-c.closeCh:
                                c.failLeftRequestsWhenClose()
                                return
   
                        case req := <-c.incomingRequestsCh:
                                if req == nil {
                                        return // TODO: this never gonna be 
happen
                                }
                                c.internalSendRequest(req)
                        }
                }
        }()
   
        for {
                select {
                case <-c.closeCh:
                        return
   
                case cmd := <-c.incomingCmdCh:
                        c.internalReceivedCommand(cmd.cmd, 
cmd.headersAndPayload)
                case data := <-c.writeRequestsCh:
                        if data == nil {
                                return
                        }
                        c.internalWriteData(data)
   
                case <-pingSendTicker.C:
                        c.sendPing()
                }
        }
   ```
   
   `c.internalSendRequest(req)` and `c.internalWriteData(data)/c.sendPing()` 
are invoked in 2 goroutines, and they will call `c.cnx.Write()` finally.
   #### System configuration
   **Pulsar version**: x.y
   


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