AlexStocks commented on code in PR #142:
URL: https://github.com/apache/dubbo-getty/pull/142#discussion_r3791614016


##########
client.go:
##########
@@ -416,7 +416,28 @@ func (c *client) RunEventLoop(newSession 
NewSessionCallback) {
        c.Lock()
        c.newSession = newSession
        c.Unlock()
-       c.reConnect()
+       <-c.runReconnect()
+}
+
+func (c *client) runReconnect() <-chan struct{} {
+       done := make(chan struct{})
+       c.Lock()
+       select {
+       case <-c.done:
+               c.Unlock()
+               close(done)
+               return done
+       default:
+               c.wg.Add(1)
+       }
+       c.Unlock()
+
+       go func() {
+               defer c.wg.Done()
+               defer close(done)
+               c.reConnect()
+       }()

Review Comment:
   [P1] 并发重连确定会突破连接池上限
   
   当前 Head `1994e7cf2f5dd40d24da00e3d7a9b587f45dc18f` 的确定性探针让两个 
`runReconnect()` 同时通过 `newSession` barrier;在 `WithConnectionNumber(1)` 下释放后 
`len(ssMap)` 为 2。根因正是 `sessionNum()` 检查与 `ssMap` 插入分属不同临界区。请对重连 loop 做 
single-flight/串行化,并补并发触发仍严格遵守 pool limit 的回归测试。



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

Reply via email to