Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

发布评论时不定期出现 panic: runtime error: invalid memory address or nil pointer dereference 错误 #478

Closed
iXinXuan opened this issue Apr 2, 2023 · 3 comments · Fixed by #481
Labels
bug Something isn't working high priority Consider now

Comments

@iXinXuan
Copy link

iXinXuan commented Apr 2, 2023

造成报错的操作:

回复评论时会出现,复现没有规律性,但一般在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/[email protected]/server.go:952
github.com/valyala/fasthttp.(*RequestCtx).QueryArgs(0x0)
/root/go/pkg/mod/github.com/valyala/[email protected]/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/[email protected]/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

@mosuzi
Copy link

mosuzi commented Apr 6, 2023

一样的问题:
而且我的是每次评论时都会崩溃重启,但是数据似乎是有的

OS: centos 7.9
版本:2.5.2

要测试这个bug的话还需要什么额外信息?

报错如下图

image

@qwqcode qwqcode added bug Something isn't working high priority Consider now labels Apr 6, 2023
@mosuzi
Copy link

mosuzi commented Apr 6, 2023

感觉像是这里的 c 已经为空了
image

@qwqcode
Copy link
Member

qwqcode commented Apr 6, 2023

感觉像是这里的 c 已经为空了

image

非常感谢你提供的线索!我也觉得是这个原因。

之前更换了 http 框架,由于新 fiber 框架的性能优化设计,导致在新开的 goroutine(线程)中引用 Context 指针资源被提前释放,故出现了 SIGSEGV 错误。

qwqcode added a commit that referenced this issue Apr 6, 2023
@qwqcode qwqcode linked a pull request Apr 6, 2023 that will close this issue
qwqcode added a commit that referenced this issue Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority Consider now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants