-
Notifications
You must be signed in to change notification settings - Fork 888
Open
Description
Describe the bug
server和client同时启动多路复用时,关闭server服务client会触发panic
logger.go:190: [Error] GOPOOL: panic in pool: gopool.DefaultPool: runtime error: invalid memory address or nil pointer dereference: goroutine 11 [running]:
runtime/debug.Stack()
/usr/local/go/src/runtime/debug/stack.go:26 +0x64
github.com/bytedance/gopkg/util/gopool.(*worker).run.func1.1.1()
/Users/chanlon/go/pkg/mod/github.com/bytedance/[email protected]/util/gopool/worker.go:64 +0x80
panic({0x100fb8900?, 0x101572960?})
/usr/local/go/src/runtime/panic.go:791 +0x124
github.com/cloudwego/kitex/pkg/remote.GetPayloadCodec({0x10109c828, 0x14001980230})
/Users/chanlon/go/pkg/mod/github.com/cloudwego/[email protected]/pkg/remote/payload_codec.go:41 +0x4c
github.com/cloudwego/kitex/pkg/remote/codec.(*defaultCodec).DecodePayload(0x101593540?, {0x1010966b0, 0x1015bc1e0}, {0x10109c828, 0x14001980230}, {0x10109f230, 0x1400198a690})
/Users/chanlon/go/pkg/mod/github.com/cloudwego/[email protected]/pkg/remote/codec/default_codec.go:234 +0x88
github.com/cloudwego/kitex/pkg/remote/codec.(*defaultCodec).Decode(0x101593540, {0x1010966b0, 0x1015bc1e0}, {0x10109c828, 0x14001980230}, {0x10109f230, 0x1400198a690})
/Users/chanlon/go/pkg/mod/github.com/cloudwego/[email protected]/pkg/remote/codec/default_codec.go:256 +0x68
github.com/cloudwego/kitex/pkg/remote/trans/netpollmux.(*muxCliConn).OnRequest(0x1400198a2a0, {0x1010966b0, 0x1015bc1e0}, {0x10109e660, 0x1400198c000})
/Users/chanlon/go/pkg/mod/github.com/cloudwego/[email protected]/pkg/remote/trans/netpollmux/mux_conn.go:88 +0x238
github.com/cloudwego/netpoll.(*connection).onProcess.func1()
/Users/chanlon/go/pkg/mod/github.com/cloudwego/[email protected]/connection_onevent.go:216 +0x240
github.com/bytedance/gopkg/util/gopool.(*worker).run.func1.1(0x0?, 0x0?)
/Users/chanlon/go/pkg/mod/github.com/bytedance/[email protected]/util/gopool/worker.go:69 +0x50
github.com/bytedance/gopkg/util/gopool.(*worker).run.func1()
/Users/chanlon/go/pkg/mod/github.com/bytedance/[email protected]/util/gopool/worker.go:70 +0x18c
created by github.com/bytedance/gopkg/util/gopool.(*worker).run in goroutine 8
/Users/chanlon/go/pkg/mod/github.com/bytedance/[email protected]/util/gopool/worker.go:41 +0x5c
To Reproduce
最小复现步骤:直接使用官网教程案例
- clone代码进入basic目录
git clone https://github.com/cloudwego/kitex-examples.git
cd basic
- 修改server代码,启动多路复用
func main() {
svr := echo.NewServer(new(EchoImpl), server.WithMuxTransport())
if err := svr.Run(); err != nil {
log.Println("server stopped with error:", err)
} else {
log.Println("server stopped")
}
}
- 修改client代码,启动多路复用,并等待关闭信号
func main() {
cli, err := echo.NewClient("echo", client.WithHostPorts("127.0.0.1:8888"), client.WithMuxConnection(1))
if err != nil {
klog.Warnf("failed to new client: %s", err)
return
}
req := &api.Request{Message: "my request"}
resp, err := cli.Echo(context.Background(), req)
if err != nil {
klog.Warnf("failed to call: %s", err)
return
}
klog.Infof("resp: %s", resp.Message)
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
<-sigChan
}
- 关闭server进程,查看client控制台日志可以看到panic信息如上
Expected behavior
正常关闭server时,client不应该panic
Kitex version:
kitex --version v0.14.1
Environment:
GOVERSION='go1.23.11'
GOARCH='arm64'
GOHOSTOS='darwin'
Additional context
Metadata
Metadata
Assignees
Labels
No labels