phpcyy opened a new issue, #3161: URL: https://github.com/apache/dubbo-go/issues/3161
### ✅ 验证清单 - [x] 🔍 我已经搜索过 [现有 Issues](https://github.com/apache/dubbo-go/issues),确信这不是重复问题 ### 🚀 Go 版本 1.25.5 ### 📦 Dubbo-go 版本 v3.3.1 ### 🖥️ 服务端配置 v3.3.1 ### 💻 客户端配置 v3.3.1 ### 🌐 协议配置 triple ### 📋 注册中心配置 _No response_ ### 💾 操作系统 🐧 Linux ### 📝 Bug 描述 在 dubbo client 发起请求时,如果服务端地址发生连接超时,已经设置的超时时间无效,服务会等待 127 秒以后返回 "connection timed out"。 ### 🔄 重现步骤 ``` func main() { // 不设置 timeout,使用默认 3s DubboClient, err := client.NewClient( client.WithClientRequestTimeout(time.Second), client.WithClientRetries(0), client.WithClientShutdown(graceful_shutdown.WithoutInternalSignal()), client.WithClientURL("10.255.255.1:8080"), ) if err != nil { panic(err) } greetServant, err := hello.NewGreetService(DubboClient) if err != nil { panic(err) } start := time.Now() ctx, cancel := context.WithTimeout(context.Background(), time.Second) defer cancel() _, err = greetServant.Greet(ctx, &hello.GreetRequest{Name: "hello"}) logger.Infof("Request Greet finished, cost=%v, err=%v", time.Since(start), err) } ``` 使用以上代码,在 linux 上执行,报错 `Request Greet finished, cost=2m7.248793753s, err=unavailable: dial tcp 10.255.255.1:8080: connect: connection timed out` ### ✅ 预期行为 服务应该在 1s 以后返回报错。 ### ❌ 实际行为 服务在 2m7s 以后才返回报错。 ### 💡 可能的解决方案 Client 的 timeout 和单次调用的 timeout 在发生 connect timeout 时不生效,需要修改 http2Client 初始化的 net.Dial(network, addr) 为 (&net.Dialer{}).DialContext(ctx, network, addr)。 -- 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]
