cloudwego / netpoll

A high-performance non-blocking I/O networking framework focusing on RPC scenarios.
Apache License 2.0
4.07k stars 470 forks source link

RPC超时后 空指针异常 #281

Closed voyager-hang closed 1 year ago

voyager-hang commented 1 year ago

RPC超时后 空指针异常

  1. kitex:github.com/cloudwego/kitex v0.5.2
  2. netpool: github.com/cloudwego/netpoll v0.3.2

重现重现行为的步骤:

  1. kitex 调用 kitex 的RPC接口设置超时
  2. 在RPC超时后 提供服务的方法还在执行
  3. 在提供服务的方法执行完后出现错误
  4. 后续网络操作变的非常缓慢,比如websocket发送文本,花费了大约80秒

预期

  1. 无错误,继续执行后续操作

错误信息 2023/08/10 16:01:01.641113 logger.go:190: [Error] GOPOOL: panic in pool: gopool.DefaultPool: runtime error: invalid memory address or nil pointer dereference: goroutine 159546 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x65 github.com/bytedance/gopkg/util/gopool.(*worker).run.func1.1.1() /home/gitlab-runner/go/pkg/mod/github.com/bytedance/gopkg@v0.0.0-20230418090422-343ae5fedd5f/util/gopool/worker.go:64 +0x94 panic({0x33e2b20, 0x5f1dfd0}) /usr/local/go/src/runtime/panic.go:884 +0x212 github.com/cloudwego/netpoll.(*LinkBuffer).WriteBuffer(0xc00043a780?, 0xc000641e28?) /home/gitlab-runner/go/pkg/mod/github.com/cloudwego/netpoll@v0.3.2/nocopy_linkbuffer.go:407 +0x33 github.com/cloudwego/netpoll.(*LinkBuffer).Append(0xc000641e18?, {0x40be620?, 0xc0018e8dc0?}) /home/gitlab-runner/go/pkg/mod/github.com/cloudwego/netpoll@v0.3.2/nocopy_linkbuffer.go:393 +0x32 github.com/cloudwego/netpoll.(*connection).Append(0x1bd6215?, {0x40be620?, 0xc0018e8dc0?}) /home/gitlab-runner/go/pkg/mod/github.com/cloudwego/netpoll@v0.3.2/connection_impl.go:236 +0x2a github.com/cloudwego/netpoll/mux.(*ShardQueue).deal(0xc000ff50e0, {0xc0008c5800, 0x1, 0xc00011e010?}) /home/gitlab-runner/go/pkg/mod/github.com/cloudwego/netpoll@v0.3.2/mux/shard_queue.go:180 +0x92 github.com/cloudwego/netpoll/mux.(*ShardQueue).foreach.func1() /home/gitlab-runner/go/pkg/mod/github.com/cloudwego/netpoll@v0.3.2/mux/shard_queue.go:154 +0x152 github.com/bytedance/gopkg/util/gopool.(*worker).run.func1.1(0x0?, 0x33f35e0?) /home/gitlab-runner/go/pkg/mod/github.com/bytedance/gopkg@v0.0.0-20230418090422-343ae5fedd5f/util/gopool/worker.go:69 +0x66 github.com/bytedance/gopkg/util/gopool.(*worker).run.func1() /home/gitlab-runner/go/pkg/mod/github.com/bytedance/gopkg@v0.0.0-20230418090422-343ae5fedd5f/util/gopool/worker.go:70 +0xe5 created by github.com/bytedance/gopkg/util/gopool.(*worker).run /home/gitlab-runner/go/pkg/mod/github.com/bytedance/gopkg@v0.0.0-20230418090422-343ae5fedd5f/util/gopool/worker.go:41 +0x56 {"level":"debug","ts":1691654462.0213716,"logger":"conn.mtproto","caller":"runtime/asm_amd64.s:1594","msg":"Handle message","account_sn":"447469336100","scope_id":"1054/Telegram/Personal","v":"v0.84.0","conn_id":0,"dc_id":4,"type_id":"0x74ae4240","type_name":"updates#74ae4240","size_bytes":64,"msg_id":7265600589798032385}

voyager-hang commented 1 year ago

去掉kitex的多路复用就可以了,server.WithMuxTransport() 。。。。。。。。。。。。。。。

joway commented 1 year ago

@voyager-hang server 开启多路复用的时候,client 也必须要使用多路复用