go-qml / qml

QML support for the Go language
Other
1.96k stars 187 forks source link

"fatal error: malloc/free - deadlock" when using x64 go/libs on windows #13

Closed htoothrot closed 11 years ago

htoothrot commented 11 years ago

This was posted to the newsgroup, but I didn't see any issue for it here.

I'm using:

All the examples I tried would build successfully but give a stack trace similar to this when run:

D:\dev\gopath\src\github.com\niemeyer\qml\examples\particle>go build

D:\dev\gopath\src\github.com\niemeyer\qml\examples\particle>particle.exe
fatal error: malloc/free - deadlock
[signal 0xc0000005 code=0x0 addr=0x30 pc=0x41e56a]

runtime stack:
runtime: unexpected return pc for runtime.sigpanic called from 0x7fefda896cb
runtime.throw(0x632d60)
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/panic.c:464 +0x74
runtime.mallocgc(0x10, 0x0, 0x0)
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/malloc.goc:51 +0x57
runtime.mal(0x10)
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/malloc.goc:700 +0x3b
copyin(0x4e3260, 0x22fb88, 0x22fba0)
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/iface.c:153 +0x6a
runtime.convT2E(0x4e3260, 0x63180f, 0x31, 0x4e3260, 0x31)
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/iface.c:221 +0x46
runtime.newErrorString(0x63180f, 0x31, 0x22fbd8)
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/error.go:74 +0x3d
runtime.panicstring(0x63180f)
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/panic.c:477 +0x94
runtime.sigpanic()
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/os_windows.c:337 +0xca
runtime.mallocgc(0x10, 0x0, 0x0)
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/malloc.goc:70 +0xfa
runtime.mal(0x10)
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/malloc.goc:700 +0x3b
copyin(0x4e3260, 0x22fd10, 0x22fd28)
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/iface.c:153 +0x6a
runtime.convT2E(0x4e3260, 0x63180f, 0x31, 0x4e3260, 0x31)
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/iface.c:221 +0x46
runtime.newErrorString(0x63180f, 0x31, 0x22fd60)
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/error.go:74 +0x3d
runtime.panicstring(0x63180f)
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/panic.c:477 +0x94
runtime: unexpected return pc for runtime.sigpanic called from 0x7fefda896cb
runtime.sigpanic()
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/os_windows.c:337 +0xca

goroutine 4 [syscall]:
runtime.cgocall(0x49bb72, 0x7ddf90)
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/cgocall.c:149 +0x120 fp=0x7ddf78
github.com/niemeyer/qml._Cfunc_idleTimerInit(0x63ca9c)
    C:/Users/michael/AppData/Local/Temp/go-build834293743/github.com/niemeyer/qml/_obj/_cgo_defun.c:223 +0x34 fp=0x7ddf90
github.com/niemeyer/qml.guiLoop()
    D:/dev/gopath/src/github.com/niemeyer/qml/bridge.go:31 +0x48 fp=0x7ddfa0
runtime.goexit()
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/proc.c:1389 fp=0x7ddfa8
created by github.com/niemeyer/qml.Init
    D:/dev/gopath/src/github.com/niemeyer/qml/qml.go:58 +0xa3

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0x63cadc)
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/sema.goc:199 +0x33
sync.(*Mutex).Lock(0x63cad8)
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/sync/mutex.go:66 +0xd9
github.com/niemeyer/qml.Init(0x0)
    D:/dev/gopath/src/github.com/niemeyer/qml/qml.go:59 +0xb6
main.main()
    D:/dev/gopath/src/github.com/niemeyer/qml/examples/particle/main.go:10 +0x2c

goroutine 3 [syscall]:
runtime.goexit()
    C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist259766551/go/src/pkg/runtime/proc.c:1389

Let me know if I can provide anymore information.

niemeyer commented 11 years ago

As mentioned in the answer to the original group post, this might be related to MinGW 64bit, which feels a bit dubious according to these notes:

People that tried the 32bit versions of both MinGW and Qt apparently got it working consistently.

I'll close this as being the case for the time being. If you find some further evidence that this is a problem in the qml package itself rather than in the environment, please reopen it including these details so we can investigate further.

Thanks, and sorry for not having better news.

htoothrot commented 10 years ago

Just wanted to point to pull request https://github.com/niemeyer/qml/pull/21 which includes a work around for this issue, in case anyone else stumbles across this issue by searching.

niemeyer commented 10 years ago

As mentioned in that issue, the logic in idletimer.cpp has been changed to not depend on glib anymore, and we have people successfully using the qml package on Windows. I believe both of these bugs are fixed, but please do reopen if that's not the case.