bytedance / sonic

A blazingly fast JSON serializing & deserializing library
Apache License 2.0
6.92k stars 339 forks source link

&rt.GoString{Ptr:(unsafe.Pointer)(nil), Len:6} has nil pointer while its length is not zero! #473

Closed surethink closed 1 year ago

surethink commented 1 year ago

When I make stress testing, 1400 more request success, only one request fails caused by a panic below, I understand the error message literally. But have no idea how to fix it. Can anyone tell me more info on what may cause the panic, thanks

’‘‘ Recovery from panic val: &rt.GoString{Ptr:(unsafe.Pointer)(nil), Len:6} has nil pointer while its length is not zero! 2023-06-30 15:53:34.710791 +0800 CST m=+11.694983259 goroutine 1162 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:24 +0x65 app/application/fasthttp.fastHttpRecovery(0x100d0be?, 0x1, 0xc002095200) /Users/demo/Dev/work/backend/go/src/app/application/fasthttp/server.go:164 +0x445 panic({0x245b320, 0xc00061b770}) /usr/local/go/src/runtime/panic.go:884 +0x213 github.com/bytedance/sonic/internal/encoder.goPanic(0xc002f93068?, 0x25b00e0?) /Users/demo/go/pkg/mod/github.com/bytedance/sonic@v1.9.2/internal/encoder/errors.go:61 +0x65 encode_model.User() ?:0 +0x45ad ’‘’

liuq19 commented 1 year ago

This seems to be a concurrence problem, the string is written badly. You could add -race in test to detect the concurrence problem.

surethink commented 1 year ago

thanks