You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/09/25 16:20:24 UTC

[GitHub] [pulsar-client-go] zzzming commented on pull request #366: [WIP][consumer] Deadlock with in-flight acknowledgements

zzzming commented on pull request #366:
URL: https://github.com/apache/pulsar-client-go/pull/366#issuecomment-699022423


   @jiazhai How about move the consumer and producer listener's ConnectionClosed() code  https://github.com/apache/pulsar-client-go/blob/master/pulsar/internal/connection.go#L763
   
   to https://github.com/apache/pulsar-client-go/blob/master/pulsar/internal/connection.go#L372
   
   I hope that can guarantee close of handlers. It becomes something like
   ```
   	go func() {
   		for {
   			select {
   			case <-c.closeCh:
   				c.log.Info("1st go loop closeCh")
   				consumerHandlers := make(map[uint64]ConsumerHandler)
   				c.consumerHandlersLock.RLock()
   				for id, handler := range c.consumerHandlers {
   					consumerHandlers[id] = handler
   				}
   				c.consumerHandlersLock.RUnlock()
   
   				for _, handler := range consumerHandlers {
   					handler.ConnectionClosed()
   				}
   
   				return
   
   			case req := <-c.incomingRequestsCh:
   				if req == nil {
   					return // TODO: this never gonna be happen
   				}
   				c.internalSendRequest(req)
   			}
   		}
   	}()
   ```


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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org