yisier / nps

基于NPS 0.29.10 版本二开而来,NPS接力项目。公益云NPS:https://natnps.com
GNU General Public License v3.0
2.02k stars 256 forks source link

websocket报错 #9

Closed iLayPark closed 1 year ago

iLayPark commented 1 year ago

2022/10/31 01:12:28 worker with func exits from a panic: runtime error: invalid memory address or nil pointer dereference 2022/10/31 01:12:28 worker with func exits from panic: goroutine 240 [running]: github.com/panjf2000/ants/v2.(goWorkerWithFunc).run.func1.1(0xc000202a80) /go/pkg/mod/github.com/panjf2000/ants/v2@v2.4.2/worker_func.go:58 +0x165 panic(0xa66500, 0xf62ce0) /usr/local/go/src/runtime/panic.go:969 +0x1b9 ehang.io/nps/lib/file.(Flow).Add(0x0, 0x81, 0x81) /go/src/ehang.io/nps/lib/file/obj.go:21 +0x33 ehang.io/nps/lib/goroutine.CopyBuffer(0x7f714146f008, 0xc00000d4a0, 0xbd9920, 0xc0000a00c0, 0x0, 0x0, 0xc0000a2670, 0xe, 0x0, 0x0) /go/src/ehang.io/nps/lib/goroutine/pool.go:81 +0x2db ehang.io/nps/lib/goroutine.copyConnGroup(0xad7d00, 0xc0002930e0) /go/src/ehang.io/nps/lib/goroutine/pool.go:114 +0x15d github.com/panjf2000/ants/v2.(goWorkerWithFunc).run.func1(0xc000202a80) /go/pkg/mod/github.com/panjf2000/ants/v2@v2.4.2/worker_func.go:68 +0xb0 created by github.com/panjf2000/ants/v2.(goWorkerWithFunc).run /go/pkg/mod/github.com/panjf2000/ants/v2@v2.4.2/worker_func.go:48 +0x4c

yisier commented 1 year ago

无法复现呐小哥,你用的是http还是tcp协议,这二种协议都试过吗

iLayPark commented 1 year ago

无法复现呐小哥,你用的是http还是tcp协议,这二种协议都试过吗

http协议

iLayPark commented 1 year ago

无法复现呐小哥,你用的是http还是tcp协议,这二种协议都试过吗

如果是服务器本地的话,选择代理到服务器本地是没问题的。不是服务器本地就有问题

yisier commented 1 year ago

无法复现呐小哥,你用的是http还是tcp协议,这二种协议都试过吗

如果是服务器本地的话,选择代理到服务器本地是没问题的。不是服务器本地就有问题

你用tcp协议试试看

iLayPark commented 1 year ago

无法复现呐小哥,你用的是http还是tcp协议,这二种协议都试过吗

如果是服务器本地的话,选择代理到服务器本地是没问题的。不是服务器本地就有问题

你用tcp协议试试看

要用tcp的话原版一直就可以。

yisier commented 1 year ago

看了错误信息,貌似不是由websocket 引起的,无法复现,等等看有没有人再有类似的问题吧~~

git-zjx commented 1 year ago
2022/10/31 20:49:09.523 [D] [client.go:216]  new tcp connection with the goal of 127.0.0.1:3389, remote address:111.198.230.51:19608
2022/10/31 20:49:09 worker with func exits from a panic: runtime error: invalid memory address or nil pointer dereference
2022/10/31 20:49:09 worker with func exits from panic: goroutine 11355 [running]:
github.com/panjf2000/ants/v2.(*goWorkerWithFunc).run.func1.1(0xc000203320)
        /home/runner/go/pkg/mod/github.com/panjf2000/ants/v2@v2.4.2/worker_func.go:58 +0x16f
panic(0x1550340, 0x1a4ff00)
        /opt/hostedtoolcache/go/1.15.15/x64/src/runtime/panic.go:969 +0x1c7
ehang.io/nps/lib/file.(*Flow).Add(0x0, 0x13, 0x13)
        /home/runner/work/nps/nps/lib/file/obj.go:21 +0x3a
ehang.io/nps/lib/goroutine.CopyBuffer(0x16c29a0, 0xc0008ca0a0, 0x1676b393138, 0xc000602700, 0x0, 0x0, 0xc000680410, 0xe, 0x0, 0x0)
        /home/runner/work/nps/nps/lib/goroutine/pool.go:81 +0x2dc
ehang.io/nps/lib/goroutine.copyConnGroup(0x15c0d40, 0xc0002726e0)
        /home/runner/work/nps/nps/lib/goroutine/pool.go:114 +0x165
github.com/panjf2000/ants/v2.(*goWorkerWithFunc).run.func1(0xc000203320)
        /home/runner/go/pkg/mod/github.com/panjf2000/ants/v2@v2.4.2/worker_func.go:68 +0xb7
created by github.com/panjf2000/ants/v2.(*goWorkerWithFunc).run
        /home/runner/go/pkg/mod/github.com/panjf2000/ants/v2@v2.4.2/worker_func.go:48 +0x53

2022/10/31 20:49:09 worker with func exits from a panic: runtime error: invalid memory address or nil pointer dereference
2022/10/31 20:49:09 worker with func exits from panic: goroutine 11354 [running]:
github.com/panjf2000/ants/v2.(*goWorkerWithFunc).run.func1.1(0xc000188e40)
        /home/runner/go/pkg/mod/github.com/panjf2000/ants/v2@v2.4.2/worker_func.go:58 +0x16f
panic(0x1550340, 0x1a4ff00)
        /opt/hostedtoolcache/go/1.15.15/x64/src/runtime/panic.go:969 +0x1c7
ehang.io/nps/lib/file.(*Flow).Add(0x0, 0x13, 0x13)
        /home/runner/work/nps/nps/lib/file/obj.go:21 +0x3a
ehang.io/nps/lib/goroutine.CopyBuffer(0x1676b204008, 0xc000602700, 0x1676b115840, 0xc0008ca0a0, 0x0, 0x0, 0xc000680410, 0xe, 0x0, 0x0)
        /home/runner/work/nps/nps/lib/goroutine/pool.go:81 +0x2dc
ehang.io/nps/lib/goroutine.copyConnGroup(0x15c0d40, 0xc000272690)
        /home/runner/work/nps/nps/lib/goroutine/pool.go:114 +0x165
github.com/panjf2000/ants/v2.(*goWorkerWithFunc).run.func1(0xc000188e40)
        /home/runner/go/pkg/mod/github.com/panjf2000/ants/v2@v2.4.2/worker_func.go:68 +0xb7
created by github.com/panjf2000/ants/v2.(*goWorkerWithFunc).run
        /home/runner/go/pkg/mod/github.com/panjf2000/ants/v2@v2.4.2/worker_func.go:48 +0x53

配置文件:

[common]
server_addr=
conn_type=tcp
vkey=
auto_reconnection=true
max_conn=1000
flow_limit=1000
rate_limit=1000
basic_username=11
basic_password=3
web_username=user
web_password=1234
crypt=true
compress=true
#pprof_addr=0.0.0.0:9999
disconnect_timeout=60

[health_check_test1]
health_check_timeout=1
health_check_max_failed=3
health_check_interval=1
health_http_url=/
health_check_type=http
health_check_target=127.0.0.1:8083,127.0.0.1:8082

[health_check_test2]
health_check_timeout=1
health_check_max_failed=3
health_check_interval=1
health_check_type=tcp
health_check_target=127.0.0.1:8083,127.0.0.1:8082

[web]
host=
target_addr=127.0.0.1:8083,127.0.0.1:8082
git-zjx commented 1 year ago

使用原版的客户端可解决我的问题

yisier commented 1 year ago

复现出来了,的确是由新版客户端引起的,可以暂时使用0.26.10 客户端,后续会修复新版本客户端的bug

yisier commented 1 year ago

已修复 v0.26.12.2