AlexStocks commented on code in PR #3592:
URL: https://github.com/apache/dubbo-go/pull/3592#discussion_r3749877831
##########
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` 与 timeout reset 共享同一个连接指针锁
本 PR 的读超时路径会经 `removeSession` 进入这里;这里在 `gettyClientMux` 下读写
`c.gettyClient`,但 `Client.Close` 在另一把 `c.mux` 下读写同一字段。并发 shutdown 与 in-flight
request timeout 是正常生命周期交错,`-race` 探针已稳定报告 line 288 read vs `Close` line 200
write,以及 `Close` line 199 read vs line 291 write。请把 `gettyClient` 的所有访问统一到
`gettyClientMux`,保持固定锁顺序,并补 `Request timeout` 与 `Close` 并发的 race 回归测试。
##########
remoting/getty/pool_test.go:
##########
@@ -18,15 +18,25 @@
package getty
import (
+ "net"
"sync"
+ "sync/atomic"
"testing"
+ "time"
)
import (
+ gettylib "github.com/apache/dubbo-getty"
+
+ perrors "github.com/pkg/errors"
"github.com/stretchr/testify/assert"
Review Comment:
[P1] 按仓库 formatter 拆分第三方 import subgroup
当前 Head 的可见 `CI` check 已在 `make check-fmt` 失败;`imports-formatter 1.0.11`
给出的唯一 diff 是在 `perrors "github.com/pkg/errors"` 与 testify imports
之间增加空行。请按该分组规则修正并重新跑 CI;在 format 阶段退出前,这个 job 的后续门禁不能视为已执行通过。
--
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]