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


##########
remoting/getty/getty_client.go:
##########
@@ -287,10 +282,12 @@ func (c *Client) transfer(session getty.Session, request 
*remoting.Request, time
        return totalLen, sendLen, perrors.WithStack(err)
 }
 
-func (c *Client) resetRpcConn() {
+func (c *Client) resetRpcConn(expected *gettyRPCClient) {
        c.gettyClientMux.Lock()
+       defer c.gettyClientMux.Unlock()
+       if c.gettyClient != expected {

Review Comment:
   [P1] 当前实现已经把 `Close` 的指针访问移到 `gettyClientMux` 下,但新增的 
`TestRequestTimeoutConcurrentWithClose` 不能检出这次修复的回退。我在隔离副本中只删除 `Close` 里的 
`gettyClientMux.Lock/Unlock`,然后执行 `go test -race ./remoting/getty -run 
'^TestRequestTimeoutConcurrentWithClose$' -count=50`,50 次仍全部通过;测试只是等 `WritePkg` 
返回后并发启动 Close,没有用 barrier 强制 Close 的指针读写与 timeout reset 
重叠,实际调度可以完全串行化。请把回归测试改成确定性交错:例如先持有 `gettyClientMux` 再启动 Close,证明 Close 
必须等待该锁,或增加测试 seam 让 Close/reset 的指针访问同时进入;错误锁域 mutant 必须稳定失败后,才能防止原 data race 
回归。



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