使用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/[email protected]/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/[email protected]/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/[email protected]/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
- 1 回答
- 0 關注
- 143 瀏覽
添加回答
舉報
0/150
提交
取消