AlexStocks commented on code in PR #3592:
URL: https://github.com/apache/dubbo-go/pull/3592#discussion_r3710924477


##########
remoting/getty/getty_client.go:
##########
@@ -235,6 +235,9 @@ func (c *Client) Request(request *remoting.Request, timeout 
time.Duration, respo
 
        select {
        case <-gxtime.After(timeout):
+               
remoting.RemovePendingResponse(remoting.SequenceType(request.ID))
+               rpcClient.removeSession(session)
+               go session.Close()

Review Comment:
   [P1] 防止旧 session 的延迟 OnClose 清空新连接池
   
   这里异步关闭 session 会在第一次 `rpcClient.removeSession(session)` 之后再次触发 
`RpcClientHandler.OnClose -> 旧 rpcClient.removeSession(session)`。旧 pool 
此时已经为空,但 `removeSession` 没有确认本次实际删除了目标 session,仍会无条件调用父 
`Client.resetRpcConn()`;如果两次调用之间已有后续请求建立 replacement pool,旧 OnClose 会把新 pool 
指针和 created 标志清空,使新连接失联并造成重复建连/资源泄漏。用真实 `Client.Request` timeout 分支并控制 `Close 
-> OnClose` 时序可稳定复现:安装 replacement 后最终得到 `gettyClient=nil, created=false`。请让 
remove 幂等,并在同一 `gettyClientMux` 同步边界内仅当父指针仍指向当前旧 pool 时才 reset;补 `timeout -> 
replacement -> delayed OnClose` 的确定性交错测试。



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