google / gxui

An experimental Go cross platform UI library.
BSD 3-Clause "New" or "Revised" License
4.44k stars 299 forks source link

darwin: panic during event loop under race detector #70

Open cookieo9 opened 9 years ago

cookieo9 commented 9 years ago

While discovering #69, I found that in a binary build for race detection, the program will crash upon processing the first event that fires (eg: mouse move).

For example, running the polygon demo and moving the mouse gives the following panic:

fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x0 pc=0x4005ade]

runtime stack:
runtime.throw(0x454aa10, 0x2a)
    $GOPATH/go/src/runtime/panic.go:543 +0xa0
runtime.sigpanic()
    $GOPATH/go/src/runtime/sigpanic_unix.go:12 +0x62

goroutine 1 [syscall, locked to thread]:
runtime.cgocall_errno(0x4034c90, 0xc208171ec0, 0x0)
    $GOPATH/go/src/runtime/cgocall.go:125 +0xd0 fp=0xc208171ea0 sp=0xc208171e78
github.com/go-gl/glfw/v3.1/glfw._Cfunc_glfwWaitEvents()
    ??:0 +0x5c fp=0xc208171ec0 sp=0xc208171ea0
github.com/go-gl/glfw/v3.1/glfw.WaitEvents()
    $GOPATH/src/github.com/go-gl/glfw/v3.1/glfw/window.go:642 +0x2d fp=0xc208171ed0 sp=0xc208171ec0
github.com/google/gxui/drivers/gl.(*driver).run(0xc20800e100)
    $GOPATH/src/github.com/google/gxui/drivers/gl/driver.go:88 +0xa2 fp=0xc208171f10 sp=0xc208171ed0
github.com/google/gxui/drivers/gl.StartDriver(0x45c3040)
    $GOPATH/src/github.com/google/gxui/drivers/gl/driver.go:45 +0x302 fp=0xc208171f88 sp=0xc208171f10
main.main()
    $GOPATH/src/github.com/google/gxui/samples/polygon/main.go:83 +0x38 fp=0xc208171f98 sp=0xc208171f88
runtime.main()
    $GOPATH/go/src/runtime/proc.go:88 +0x1cb fp=0xc208171fe0 sp=0xc208171f98
runtime.goexit()
    $GOPATH/go/src/runtime/asm_amd64.s:2466 +0x1 fp=0xc208171fe8 sp=0xc208171fe0

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    $GOPATH/go/src/runtime/asm_amd64.s:2466 +0x1

goroutine 5 [chan receive]:
github.com/google/gxui.EventLoop(0x5604740, 0xc20800e100)
    $GOPATH/src/github.com/google/gxui/event_loop.go:8 +0x73
main.appMain(0x5604740, 0xc20800e100)
    $GOPATH/src/github.com/google/gxui/samples/polygon/main.go:79 +0x65a
created by github.com/google/gxui/drivers/gl.StartDriver
    $GOPATH/src/github.com/google/gxui/drivers/gl/driver.go:44 +0x2f4
ben-clayton commented 9 years ago

This and #70 are odd. I do not see them, and I have no idea what's causing them. Do you mind checking to see if this still occurs with 5faef7f9?

cookieo9 commented 9 years ago

I will. Also I'm using Go at tip, I'll try with the 1.4.2 compiler I use to build it as well.

cookieo9 commented 9 years ago

Still happens at tip (commit 10848b980a5499c1576777fc52ebd8f4e03d28c7), but using go 1.4.2 doesn't cause a problem on darwin.