Skip to content

reflect: fatal error: checkptr: pointer arithmetic computed bad pointer value #58109

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

Closed
smyrman opened this issue Jan 27, 2023 · 0 comments
Closed
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge

Comments

@smyrman
Copy link

smyrman commented Jan 27, 2023

Closing (reported before I could create a good reproduce case).

In short, there is the error seam to be raised by reflect.Value.Index when there is a data-race (elsewhere) in the application, but as I don't know how or why, this issue currently have little value. The error message hides the data race error (I think).

Error can be produced for me for Go 1.19.1, up until 1.19.5. Go 1.18.x seams to be fine.

Here is portion of the stack trace, althouhg I don't know how useful it is:

fatal error: checkptr: pointer arithmetic computed bad pointer value

goroutine 195 [running]:
runtime.throw({0xdc4d84?, 0x[43](https://github.com/clarify/api/actions/runs/4020732709/jobs/6908963895#step:9:44)e72d?})
	/opt/hostedtoolcache/go/1.19.5/x64/src/runtime/panic.go:1047 +0x5d fp=0xc0002a53c0 sp=0xc0002a5390 pc=0x46fb5d
runtime.checkptrArithmetic(0x0?, {0xc0002a5470?, 0x481b65?, 0x7feb3207eae8?})
	/opt/hostedtoolcache/go/1.19.5/x64/src/runtime/checkptr.go:52 +0xbb fp=0xc0002a53f0 sp=0xc0002a53c0 pc=0x43e8fb
reflect.add(...)
	/opt/hostedtoolcache/go/1.19.5/x64/src/reflect/type.go:1094
reflect.arrayAt(...)
	/opt/hostedtoolcache/go/1.19.5/x64/src/reflect/value.go:2701
reflect.Value.Index({0xcddde0?, 0xc00006f728?, 0xcc1b22?}, 0x0)
	/opt/hostedtoolcache/go/1.19.5/x64/src/reflect/value.go:1416 +0x254 fp=0xc0002a5490 sp=0xc0002a53f0 pc=0x548134
fmt.(*pp).printValue(0xc0001d7380, {0xcddde0?, 0xc00006f728?, 0x0?}, 0x76, 0x1)
	/opt/hostedtoolcache/go/1.19.5/x64/src/fmt/print.go:887 +0x26c5 fp=0xc0002a56e0 sp=0xc0002a5490 pc=0x56d8a5
fmt.(*pp).printValue(0xc0001d7380, {0xd[44](https://github.com/clarify/api/actions/runs/4020732709/jobs/6908963895#step:9:45)520?, 0xc00006f720?, 0xc000054800?}, 0x76, 0x0)
	/opt/hostedtoolcache/go/1.19.5/x64/src/fmt/print.go:837 +0x1db6 fp=0xc0002a5930 sp=0xc0002a56e0 pc=0x56cf96
fmt.(*pp).printArg(0xc0001d7380, {0xd4[45](https://github.com/clarify/api/actions/runs/4020732709/jobs/6908963895#step:9:46)20?, 0xc00006f720}, 0x76)
	/opt/hostedtoolcache/go/1.19.5/x64/src/fmt/print.go:743 +0xe18 fp=0xc0002a59f8 sp=0xc0002a5930 pc=0x56af58
fmt.(*pp).doPrintf(0xc0001d7380, {0xdc1d4e, 0x30}, {0xc0002a5ce8?, 0x2, 0x2})
	/opt/hostedtoolcache/go/1.19.5/x64/src/fmt/print.go:1057 +0x[49](https://github.com/clarify/api/actions/runs/4020732709/jobs/6908963895#step:9:50)a fp=0xc0002a5b20 sp=0xc0002a59f8 pc=0x[56](https://github.com/clarify/api/actions/runs/4020732709/jobs/6908963895#step:9:57)f6fa
fmt.Sprintf({0xdc1d4e, 0x30}, {0xc0002a5ce8, 0x2, 0x2})
	/opt/hostedtoolcache/go/1.19.5/x64/src/fmt/print.go:219 +0x68 fp=0xc0002a5b78 sp=0xc0002a5b20 pc=0x565cc8
testing.(*common).Errorf(0xc00029a000, {0xdc1d4e, 0x30}, {0xc0002a5ce8, 0x2, 0x2})
	/opt/hostedtoolcache/go/1.19.5/x[64](https://github.com/clarify/api/actions/runs/4020732709/jobs/6908963895#step:9:65)/src/testing/testing.go:940 +0x8b fp=0xc0002a5bd0 sp=0xc0002a5b78 pc=0x5a18eb

The call into reflect.Value.Index happens from either a call to go-cmps cmp.Diff, or a regulat t.Logf("%#v", v), where v is a generic struct contains a _slice_ attribute (type T[V any] struct{V []V}`) that's passed into the test.

I will create a new issue is I am able to find out more.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jan 27, 2023
@smyrman smyrman changed the title reflect: checkptr reflect: fatal error: checkptr: pointer arithmetic computed bad pointer value Jan 27, 2023
@smyrman smyrman closed this as completed Jan 27, 2023
@golang golang locked and limited conversation to collaborators Jan 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

2 participants