Windows下服务端超时报错
Describe the bug
Windows下服务端报超时错误:2024/08/01 19:00:22.348850 default_server_handler.go:259: [Error] KITEX: processing request error, remoteService=, remoteAddr=127.0.0.1:64490, error=default codec read failed: read tcp 127.0.0.1:8888->127.0.0.1:64490: i/o timeout
To Reproduce
操作系统:Windows10 IDE:Goland 步骤:
- 按照示例代码写一个最简单的Thrift服务,启动
- 再另启一个客户端连接此服务并执行一次service调用,调用显示成功
- 等待5秒后,服务端会有报错:[Error] KITEX: processing request error, remoteService=, remoteAddr=127.0.0.1:64490, error=default codec read failed: read tcp 127.0.0.1:8888->127.0.0.1:64490: i/o timeout
- 客户端此时再次调用service,失败,显示remote or network error: default codec read failed: read tcp 127.0.0.1:64490->127.0.0.1:8888: wsarecv: An established connection was aborted by the software in your host machine.
- 客户端再次调用service同一函数,又显示调用成功
- 然后循环
Kitex version:
github.com/cloudwego/kitex v0.10.3
Environment:
set GO111MODULE=on set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\admin\AppData\Local\go-build set GOENV=C:\Users\admin\AppData\Roaming\go\env set GOEXE=.exe set GOEXPERIMENT= set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOINSECURE= set GOMODCACHE=C:\Users\admin\go\pkg\mod set GONOPROXY= set GONOSUMDB= set GOOS=windows set GOPATH=C:\Users\admin\go set GOPRIVATE= set GOPROXY=https://goproxy.cn set GOROOT=C:/Program Files/Go set GOSUMDB=sum.golang.org set GOTMPDIR= set GOTOOLCHAIN=auto set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64 set GOVCS= set GOVERSION=go1.22.5 set GCCGO=gccgo set GOAMD64=v1 set AR=ar set CC=gcc set CXX=g++ set CGO_ENABLED=0 set GOMOD=C:\Users\admin\GolandProjects\kitex_learning\go.mod set GOWORK= set CGO_CFLAGS=-O2 -g set CGO_CPPFLAGS= set CGO_CXXFLAGS=-O2 -g set CGO_FFLAGS=-O2 -g set CGO_LDFLAGS=-O2 -g set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\admin\AppData\Local\Temp\go-build4009869477=/tmp/go-build -gno-record-gcc-switches
Additional context
Mac上无此问题,测试结果如下: Mac服务端,Mac客户端,无问题 Mac服务端,Windows客户端,无问题 Windows服务端,Mac客户端,服务端仍然会报错,客户端每次都调用成功 Windows服务端,Windows客户端,服务端报错,客户端报错
You can add server.WithReadWriteTimeout(2*time.Minute) to your server's option, it could make server connection idle time greater than the client pool idle time, which avoid server read timeout issue. To solve the problem totally, I think we need to make sure default server timeout greater than the client, and I will commit a pr to fix it.
You can add server.WithReadWriteTimeout(2*time.Minute) to your server's option, it could make server connection idle time greater than the client pool idle time, which avoid server read timeout issue. To solve the problem totally, I think we need to make sure default server timeout greater than the client, and I will commit a pr to fix it.
it works, thanks a lot~