Closed fgrosse closed 3 years ago
I was able to reproduce the issue on my local machine as well:
$ git rev-parse HEAD
3be4e4cb84c9a33d2ff249a3c587dfb36dfebcd0
$ go version
go version go1.14.2 linux/amd64
$ go test -race
fatal error: checkptr: unsafe pointer arithmetic
…
Update: I can reproduce this with each invocation of go test
. Does not look like a flaky test but a deterministic failure.
Looking at the stacktrace, the issue comes from:
/home/travis/gopath/pkg/mod/github.com/go-gl/gl@v0.0.0-20190320180904-bf2b1f2f34d7/v3.3-core/gl/conversions.go:55
This is the function at the vendored revision:
// PtrOffset takes a pointer offset and returns a GL-compatible pointer.
// Useful for functions such as glVertexAttribPointer that take pointer
// parameters indicating an offset rather than an absolute memory address.
func PtrOffset(offset int) unsafe.Pointer {
return unsafe.Pointer(uintptr(offset))
}
Apparently this panics in the runtime with the checkptr: pointer arithmetic computed bad pointer value
error (via go/src/runtime/checkptr.go:26
).
I wonder why Pixel imports v3.3-core/gl
already. I thought the GLFW update is still pending in #211?
Apparently github.com/go-gl/gl/v3.3-core
is transitively used already via the currently used version of github.com/faiface/glhf
?
On the other hand, I ran the same test with zergon321/add-glfw-v33
and get the same issue.
Running this without the race detector does not panic. Could be that the check is only enabled with the race detector or could be the defect is caused by a race condition?
Hmm that seems strange. When I checked the Travis output, it said this command:
go test -v -race -mod=readonly ./...
exits with 1.
Running it locally, i found it passes when outside gopath and fails when inside gopath:
go test -v -race -mod=readonly ./...
build flag -mod=readonly only valid when using modules
running go test -race
in my environment passes right now
$ go version
go version go1.12.5 linux/amd64
I think you do not see the checkptr
issue because that is a new feature of Go 1.14
This release adds -d=checkptr as a compile-time option for adding instrumentation to check that Go code is following unsafe.Pointer safety rules dynamically. This option is enabled by default (except on Windows) with the -race or -msan flags, […]
https://golang.org/doc/go1.14#compiler
Running it locally, i found it passes when outside gopath and fails when inside gopath:
I believe that you are describing an unrelated issue. You should not to use modules inside the Go path.
The documentation I linked above also gives some more description of the check that currently fails:
Specifically, -d=checkptr checks the following:
I haven't worked with unsafe
yet but maybe somebody knows what it means that a pointer must be "aligned appropriately" :shrug:
Here the link to a fix of this problem in another Go program: https://github.com/pingcap/tidb/pull/14972
I should take a look at this tonight, good learning opportunity.
I noticed Pixels current build on
master
fails on Travis with the following fatal error: