Closed iXinXuan closed 1 year ago
一样的问题: 而且我的是每次评论时都会崩溃重启,但是数据似乎是有的
OS: centos 7.9 版本:2.5.2
要测试这个bug的话还需要什么额外信息?
报错如下图
感觉像是这里的 c 已经为空了
感觉像是这里的 c 已经为空了
非常感谢你提供的线索!我也觉得是这个原因。
之前更换了 http 框架,由于新 fiber 框架的性能优化设计,导致在新开的 goroutine(线程)中引用 Context 指针资源被提前释放,故出现了 SIGSEGV 错误。
造成报错的操作:
回复评论时会出现,复现没有规律性,但一般在10条以内。
报错信息:
panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x107d959]
goroutine 196 [running]: github.com/valyala/fasthttp.(RequestCtx).URI(...) /root/go/pkg/mod/github.com/valyala/fasthttp@v1.45.0/server.go:952 github.com/valyala/fasthttp.(RequestCtx).QueryArgs(0x0) /root/go/pkg/mod/github.com/valyala/fasthttp@v1.45.0/server.go:991 +0x19 github.com/gofiber/fiber/v2.(*Ctx).Query(0xc000243080, {0x159d161, 0x5}, {0x0, 0x0, 0xc01649e108?}) /root/go/pkg/mod/github.com/gofiber/fiber/v2@v2.42.0/ctx.go:1105 +0x45 github.com/ArtalkJS/Artalk/server/common.GetJwtInstanceByReq(0xc01649e108?) /go/src/github.com/ArtalkJS/Artalk/server/common/auth.go:59 +0x35 github.com/ArtalkJS/Artalk/server/common.CheckIsAdminReq(0x4?) /go/src/github.com/ArtalkJS/Artalk/server/common/check.go:25 +0x2e github.com/ArtalkJS/Artalk/server/handler.CommentAdd.func1.1() /go/src/github.com/ArtalkJS/Artalk/server/handler/comment_add.go:163 +0xbc created by github.com/ArtalkJS/Artalk/server/handler.CommentAdd.func1 /go/src/github.com/ArtalkJS/Artalk/server/handler/comment_add.go:156 +0xe5b
环境信息:
Artalk (2.5.2/febe890)
-> A Selfhosted Comment System. -> https://artalk.js.org
┌───────────────────────────────────────────────────┐ │ Fiber v2.42.0 │ │ http://127.0.0.1:8080 │ │ (bound on host 0.0.0.0 and port 8080) │ │ │ │ Handlers ............ 78 Processes ........... 1 │ │ Prefork ....... Disabled PID ............ 425157 │ └───────────────────────────────────────────────────┘
服务器环境:CentOS Stream 8