AlexStocks commented on code in PR #3592:
URL: https://github.com/apache/dubbo-go/pull/3592#discussion_r3841454308
##########
remoting/getty/getty_client.go:
##########
@@ -256,6 +256,9 @@ func (c *Client) RequestContext(ctx context.Context,
request *remoting.Request,
defer timer.Stop()
select {
case <-timer.C:
+
remoting.RemovePendingResponse(remoting.SequenceType(request.ID))
+ rpcClient.removeSession(session)
Review Comment:
[P1] 这个新增 timeout 路径会与 `Client.Close()` 并发进入同一个 `gettyRPCClient.close()`,当前
Head 自带的 `TestRequestTimeoutConcurrentWithClose` 在 `-race -count=1` 已稳定失败。race
栈显示 timeout 线程经本行 `removeSession -> close` 在 `pool.go:302` 执行
`perrors.Errorf("close gettyRPCClient{%#v} again", c)`,反射读取整个可变 client;同时 Close
线程已进入 `once.Do`,正在清空 `sessions/gettyClient`、更新 `active`。`sync.Once`
保护不了它外面的这次格式化读取,因此产生多处真实 data race。请把重复关闭的诊断构造移入受保护区域,或不要在
Once/锁外格式化整个可变对象,并保留当前确定性交错测试且要求 `go test -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]