zzzming commented on issue #859: URL: https://github.com/apache/pulsar-client-go/issues/859#issuecomment-1275468328
Thank you for reporting this. Although it's 0.6.0, the same logic exists in the current master. The problem is basically WaitGroup does not allow Wait() and Add() to run concurrently. (Add() itself can run concurrently). This is clearly explained in the Go WaitGroup source code at https://github.com/golang/go/blob/master/src/sync/waitgroup.go#L40 ``` // If a WaitGroup is reused to wait for several independent sets of events, // new Add calls must happen after all previous Wait calls have returned. ``` The WaitGroup, incomingRequestsWG, in the connection.go waits all the sent requests before close the main run goroutine. The design is for run() wait for any requests to be completed if there is any. So both Wait() and Add() are in this concurrent manner. This is a misuse of Go's WaitGroup. I will do a PR to use channel -- 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]
