nodece opened a new pull request, #1484: URL: https://github.com/apache/pulsar-client-go/pull/1484
### Motivation Fixes #1483 When the connection is closed while `SendRequest`/`SendRequestNoWait` are in flight, `failLeftRequestsWhenClose` calls `Wait()` on the WaitGroup. Concurrent goroutines that pass the `getState()` check may still call `Add(1)`, triggering `sync: WaitGroup is reused before previous Wait has returned` panic in Go 1.25+. ### Modifications - Protect the state check and `Add(1)` under `c.mu.RLock()` in `SendRequest` and `SendRequestNoWait`. `Close()` sets state under `c.mu.Lock()`, so the check-and-add is atomic with respect to `Close()`. After state is set to `connectionClosed`, no new `Add(1)` can happen, ensuring `Wait()` will always return. - Replace the nil-sentinel goroutine drain with a non-blocking drain after `Wait()`. Since `Wait()` guarantees all requests are already enqueued, a non-blocking drain is sufficient for strict correctness. -- 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]
