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


##########
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)

Review Comment:
   [P1] 这里把整个重连 goroutine 计入 `wg` 后,`NewSessionCallback` 内调用公开的 
`Client.Close()` 会等待当前 goroutine 自己,形成确定性死锁。固定 Base/Head 的公开入口探针中,Base 在回调调用 
`Close()` 并返回错误后正常退出;当前 Head 在 500ms 内始终无法返回。回调文档没有禁止关闭所属 
endpoint,这类连接校验失败后主动停机的用法不能被锁死。请避免让 `Close()` 等待正在执行该回调的 worker(例如把停止信号与外部 join 
分离,或调整重连任务的生命周期登记),并补一个回调内关闭客户端的回归测试。



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