Closed
Description
For some reason certain action in C code forces segfault in Go. It was found in my gtk bindings, I have stipped it down to one test file that segfaults on my machine. I did hg bisect, the problem appears starting from revision 11922:daf22f371d51 (os/signal: selective signal handling). Here's the source code: -------------------------------------------------------------------- package main /* #include <gtk/gtk.h> #cgo pkg-config: gtk+-3.0 */ import "C" func main() { C.gtk_init(nil, nil) C.gtk_file_chooser_button_new(nil, 0) } -------------------------------------------------------------------- It happens on linux 3.2.8 (archlinux distribution), as stated above any go version starting from rev 11922, x86 achitecture, gtk 3.2.3 Here's the backtrace from gdb: (gdb) bt #0 runtime.sigtramp (sig=void, info=void, context=void) at /home/nsf/go/src/pkg/runtime/sys_linux_386.s:176 #1 0x0805842b in runtime.sigtramp (sig=void, info=void, context=void) at /home/nsf/go/src/pkg/runtime/sys_linux_386.s:195 #2 0x00000011 in ?? () #3 0xb47fe99c in ?? () #4 0x00000000 in ?? () And it seems that app creates a bunch of threads (could be related or not): (gdb) info threads Id Target Id Frame * 5 Thread 0xb47ffb40 (LWP 1903) "test" runtime.sigtramp (sig=void, info=void, context=void) at /home/nsf/go/src/pkg/runtime/sys_linux_386.s:176 4 Thread 0xb53e2b40 (LWP 1902) "test" 0xb7fdd424 in __kernel_vsyscall () 3 Thread 0xb5be3b40 (LWP 1901) "test" 0xb7fdd424 in __kernel_vsyscall () 2 Thread 0xb6f48b40 (LWP 1900) "test" 0xb7fdd424 in __kernel_vsyscall () 1 Thread 0xb7089800 (LWP 1897) "test" 0xb747d026 in _int_free () from /lib/libc.so.6 If you guys are totally have no idea what's that, I can also try to dig gtk3 and remove it from the test case (reproducing the bug with simple libraries only, like pthreads). But I think it will be quite hard to do. P.S. The same code in C runs fine: --------------------------------------------------------------------- [nsf @ go-test]$ cat test.c #include <gtk/gtk.h> int main(int argc, char **argv) { gtk_init(0, 0); gtk_file_chooser_button_new(0, 0); } [nsf @ go-test]$ gcc -o test test.c `pkg-config --cflags --libs gtk+-3.0` [nsf @ go-test]$ ./test [nsf @ go-test]$ gdb --quiet ./test Reading symbols from /home/nsf/tmp/go-test/test...(no debugging symbols found)...done. (gdb) run Starting program: /home/nsf/tmp/go-test/test [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/libthread_db.so.1". [New Thread 0xb6745b40 (LWP 2034)] [New Thread 0xb5dffb40 (LWP 2035)] [New Thread 0xb53ffb40 (LWP 2036)] [Thread 0xb53ffb40 (LWP 2036) exited] [Thread 0xb5dffb40 (LWP 2035) exited] [Thread 0xb6745b40 (LWP 2034) exited] [Inferior 1 (process 2031) exited with code 0240] (gdb) quit ---------------------------------------------------------------------
Activity
bradfitz commentedon Mar 8, 2012
Comment 1:
nsf commentedon Mar 8, 2012
Comment 2:
rsc commentedon Mar 8, 2012
Comment 3:
Labels changed: added priority-go1, removed priority-triage.
Owner changed to builder@golang.org.
Status changed to Accepted.
nsf commentedon Mar 9, 2012
Comment 4:
rsc commentedon Mar 9, 2012
Comment 5:
nsf commentedon Mar 9, 2012
Comment 6:
Attachments:
nsf commentedon Mar 9, 2012
Comment 7:
rsc commentedon Mar 12, 2012
Comment 8:
Labels changed: added priority-later, removed priority-go1.
nsf commentedon Mar 12, 2012
Comment 9:
gopherbot commentedon Jun 12, 2013
Comment 10 by joshrickmar:
Attachments:
minux commentedon Jun 12, 2013
Comment 11:
gopherbot commentedon Jun 12, 2013
Comment 12 by joshrickmar:
gopherbot commentedon Jun 13, 2013
Comment 13 by joshrickmar:
gopherbot commentedon Jun 13, 2013
Comment 14 by joshrickmar:
Attachments:
minux commentedon Jul 11, 2013
Comment 15:
This issue was closed by revision 2f1ead7.
Status changed to Fixed.
gopherbot commentedon Jul 22, 2015
CL https://golang.org/cl/12503 mentions this issue.
runtime: if we don't handle a signal on a non-Go thread, raise it