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

[ast] invalid memory address or nil pointer dereference #605

Open
luoyuahui opened this issue Feb 29, 2024 · 3 comments
Open

[ast] invalid memory address or nil pointer dereference #605

luoyuahui opened this issue Feb 29, 2024 · 3 comments

Comments

@luoyuahui
Copy link

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7f2c11e84fe0]

goroutine 215 [running]:
github.com/bytedance/sonic/internal/native.Quote(0xc0000c9d00?, 0xfa1afe?, 0x2811980?, 0x0?, 0xc00936a000?)
C:/Users/123/go/pkg/mod/github.com/bytedance/sonic@v1.10.2/internal/native/dispatch_amd64.go:103 +0x15
github.com/bytedance/sonic/ast.quote(0xc009d72498, {0x0?, 0xc00936a000?})
C:/Users/123/go/pkg/mod/github.com/bytedance/sonic@v1.10.2/ast/api_amd64.go:53 +0x179
github.com/bytedance/sonic/ast.(*Node).encodeString(0xc009d72498?, 0xc009d72498?)
C:/Users/123/go/pkg/mod/github.com/bytedance/sonic@v1.10.2/ast/encode.go:177 +0xb3
github.com/bytedance/sonic/ast.(*Node).encode(...)
C:/Users/123/go/pkg/mod/github.com/bytedance/sonic@v1.10.2/ast/encode.go:134
github.com/bytedance/sonic/ast.(*Pair).encode(0xc0005b0f00, 0xc009d72498)
C:/Users/123/go/pkg/mod/github.com/bytedance/sonic@v1.10.2/ast/encode.go:235 +0x586
github.com/bytedance/sonic/ast.(*Node).encodeObject(...)
C:/Users/123/go/pkg/mod/github.com/bytedance/sonic@v1.10.2/ast/encode.go:274
github.com/bytedance/sonic/ast.(*Node).encode(0xc0003afcf8, 0xc009d72498)
C:/Users/123/go/pkg/mod/github.com/bytedance/sonic@v1.10.2/ast/encode.go:133 +0x656
github.com/bytedance/sonic/ast.(*Node).encodeArray(0xc00309f218, 0xc009d72498)
C:/Users/123/go/pkg/mod/github.com/bytedance/sonic@v1.10.2/ast/encode.go:217 +0x32c
github.com/bytedance/sonic/ast.(*Node).encode(...)
C:/Users/123/go/pkg/mod/github.com/bytedance/sonic@v1.10.2/ast/encode.go:132
github.com/bytedance/sonic/ast.(*Pair).encode(0xc00309f208, 0xc009d72498)
C:/Users/123/go/pkg/mod/github.com/bytedance/sonic@v1.10.2/ast/encode.go:235 +0x566
github.com/bytedance/sonic/ast.(*Node).encodeObject(...)
C:/Users/123/go/pkg/mod/github.com/bytedance/sonic@v1.10.2/ast/encode.go:258
github.com/bytedance/sonic/ast.(*Node).encode(0xc0089d5398, 0xc009d72498)
C:/Users/123/go/pkg/mod/github.com/bytedance/sonic@v1.10.2/ast/encode.go:133 +0x30b
github.com/bytedance/sonic/ast.(*Node).MarshalJSON(0x16174c0?)
C:/Users/123/go/pkg/mod/github.com/bytedance/sonic@v1.10.2/ast/encode.go:96 +0x2e

@AsterDY
Copy link
Collaborator

AsterDY commented Feb 29, 2024

are you using ast.Node concurrently?

@luoyuahui
Copy link
Author

are you using ast.Node concurrently?

one ast object just run in one goroutine

root, err := sonic.Get([]byte(` ...`))
...
root.Set("subkey", ast.NewAny(newval1))
root.MarshalJSON();
....
root.Set("subkey", ast.NewAny(newval2))
root.MarshalJSON();

@AsterDY
Copy link
Collaborator

AsterDY commented Mar 4, 2024

so please give reproducible codes or link

@AsterDY AsterDY closed this as completed Mar 4, 2024
@AsterDY AsterDY reopened this Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants