Aias00 commented on code in PR #3438:
URL: https://github.com/apache/dubbo-go/pull/3438#discussion_r4522486317
##########
remoting/exchange_client.go:
##########
@@ -82,20 +93,52 @@ func NewExchangeClient(url *common.URL, client Client,
connectTimeout time.Durat
}
func (cl *ExchangeClient) doInit(url *common.URL) error {
- if cl.init {
+ // Fast path: already initialized.
+ if cl.initState.Load() == initInitialized {
return nil
}
+ // Try to become the initializer.
+ if !cl.initState.CAS(initUninitialized, initInitializing) {
+ // Another goroutine is initializing. Wait for it to complete.
+ cl.initCond.L.Lock()
+ for cl.initState.Load() == initInitializing {
+ cl.initCond.Wait()
+ }
+ err := cl.initErr
Review Comment:
Fixed in `8e99b7ca`; this duplicates the finding in
https://github.com/apache/dubbo-go/pull/3438#discussion_r4513434854. The same
Close/Connect/waiter regression covers both threads.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]