为了账号安全,请及时绑定邮箱和手机立即绑定

fasthttp websocket: panic nil: websocket.(*Conn)

fasthttp websocket: panic nil: websocket.(*Conn)

Go
一只萌萌小番薯 2023-02-28 21:15:03
使用Fiber v2.38.1,后者又使用fasthttp/websocket v1.5.0。应用程序崩溃并出现以下错误:2022-10-15T04:05:42.983563+00:00 app[web.1]: time="2022-10-15T04:05:42Z" level=info msg="close msg received: &{418 close}"2022-10-15T04:05:42.983564+00:00 app[web.1]: conn is nil: false, msg: &{418 close <nil> conn 0}2022-10-15T04:05:42.986035+00:00 app[web.1]: panic: runtime error: invalid memory address or nil pointer dereference2022-10-15T04:05:42.986035+00:00 app[web.1]: [signal SIGSEGV: segmentation violation code=0x1 addr=0x78 pc=0x8db967]2022-10-15T04:05:42.986036+00:00 app[web.1]: 2022-10-15T04:05:42.986037+00:00 app[web.1]: goroutine 86 [running]:2022-10-15T04:05:42.986037+00:00 app[web.1]: github.com/fasthttp/websocket.(*Conn).beginMessage(0x0, 0xc000348f60, 0x1)2022-10-15T04:05:42.986037+00:00 app[web.1]:    /tmp/codon/tmp/cache/go-path/pkg/mod/github.com/fasthttp/websocket@v1.5.0/conn.go:479 +0x272022-10-15T04:05:42.986038+00:00 app[web.1]: github.com/fasthttp/websocket.(*Conn).NextWriter(0x0, 0x1)2022-10-15T04:05:42.986038+00:00 app[web.1]:    /tmp/codon/tmp/cache/go-path/pkg/mod/github.com/fasthttp/websocket@v1.5.0/conn.go:520 +0x452022-10-15T04:05:42.986039+00:00 app[web.1]: github.com/fasthttp/websocket.(*Conn).WriteJSON(0xe79a80?, {0xc143a0, 0xc00041e600})2022-10-15T04:05:42.986039+00:00 app[web.1]:    /tmp/codon/tmp/cache/go-path/pkg/mod/github.com/fasthttp/websocket@v1.5.0/json.go:24 +0x452022-10-15T04:05:42.986039+00:00 app[web.1]: github.com/kuchaguangjie/go-fit/model.(*WsClient).WriteMsg(0xc00056a280, 0xc00041e600)它conn.go:479在函数中崩溃于beginMessage():if c.writer != nil {我已经检查过它c不是零(如日志中所示),所以它是如何崩溃的......顺便说一句,它部署在 heroku 上,我在 heroku 上看到以下日志:2022-10-15T04:59:30.344791+00:00 heroku[路由器]: at=error code=H15 desc="空闲连接"不确定它是否相关。
查看完整描述

1 回答

?
千万里不及你

TA贡献1784条经验 获得超9个赞

这是一个 fasthttp 错误,已修复v1.5.1-rc.8

参考: https: //github.com/fasthttp/websocket/issues/30#issuecomment-1326860975


查看完整回答
反对 回复 2023-02-28
  • 1 回答
  • 0 关注
  • 98 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信