-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: Go 1.5 runtime panic, GC related #12246
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
Comments
CC @RLH @aclements It looks like C code is dereferencing a NULL pointer. |
@fogleman, I agree with @ianlancetaylor's diagnosis. Based on the crashing program counter, it looks like this is a NULL pointer dereference in a C library, which probably indicates a bug in one of the wrapper packages you're using (I would guess go-cairo based on what you said about surface.GetData()). Unfortunately, I wasn't able to reproduce it locally. If you run your program under gdb, it should trap at the NULL pointer dereference. If you then use the |
@aclements, I ran it in gdb and here's what I got:
Would the symbol packages you mentioned help here? Where do I get them? Like I mentioned, this works fine in Go 1.4.2. |
This is likely caused by the new GOMAXPROCS default. GL functions must be called from the same OS-thread that called MakeContextCurrent. At some point your code is probably running under a different OS-thread without the GL context. Try importing func init() {
runtime.LockOSThread()
} Also note that most of the glfw functions must be called from the main thread. |
@thaustad, doh! You're right. I forgot about the |
Nice call, @thaustad! @fogleman, handling this automatically would be a good feature request to send to go-gl. I see their readme does mention LockOSThread, but I bet this it going to start biting a lot more people. The x/mobile GL bindings handle this by forwarding all of the GL calls to one locked thread so users don't have to worry about goroutines versus OS threads. |
Today I was playing with go-cairo, gl and glfw and stumbled on an issue. I suspect the GC is involved. Runs fine with Go 1.4.2.
Here is the failing code:
https://gist.github.com/fogleman/568248e76b015efe801a
Note that calling
runtime.GC()
each iteration causes it to run a little longer, but it still crashes the same way.I'm grabbing a buffer from a
cairo.Surface
and copying it into an OpenGL texture. Here's the code from go-cairo that gives me the bytes:https://github.com/ungerik/go-cairo/blob/master/surface.go#L611-L620
Something about
surface.GetData()
is causing trouble. I don't have to actually pass it intogl.TexImage2D
. In that case it crashes atgl.Begin
instead.Here is the panic output:
The text was updated successfully, but these errors were encountered: