You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(1) Use cgo to mask SIGINT before Go initialize routine runs.
(2) Create a pthread with cgo, to get SIGINTs with sigwaitinfo.
(3) Run the program (attached) and press Ctrl+C in terminal (or kill -INT it).
If the Go program is started with a non-empty signal mask, that will
generally be honored. However, some signals are explicitly unblocked:
the synchronous signals, SIGILL, SIGTRAP, SIGSTKFLT, SIGCHLD, SIGPROF,
and, on GNU/Linux, signals 32 (SIGCANCEL) and 33 (SIGSETXID) (SIGCANCEL
and SIGSETXID are used internally by glibc).
The program should work: prints 2 for all SIGINTs, even with GDB debugging it.
What did you see instead?
The program exits with status 130. With GDB the stack backtrace is:
#0 syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
#1 0x00007ffff72638ec in runtime.futex (val3=0, addr2=0x0, ts=0x7ffff238ac70, val=0, op=0, addr=0x7ffff7dc1d50 <runtime.sched+176>)
at ../../../libgo/go/runtime/os_linux.go:17
#2 runtime.futexsleep (val=0, ns=60000000000, addr=0x7ffff7dc1d50 <runtime.sched+176>) at ../../../libgo/go/runtime/os_linux.go:65
#3 runtime.notetsleep_internal (n=0x7ffff7dc1d50 <runtime.sched+176>, ns=60000000000) at ../../../libgo/go/runtime/lock_futex.go:186
#4 0x00007ffff7264974 in runtime.notetsleep (n=n@entry=0x7ffff7dc1d50 <runtime.sched+176>, ns=<optimized out>)
at ../../../libgo/go/runtime/lock_futex.go:209
#5 0x00007ffff7277637 in runtime.sysmon () at ../../../libgo/go/runtime/proc.go:2157
#6 0x00007ffff6e937a4 in runtime_mstart (mp=<optimized out>) at ../../../libgo/runtime/proc.c:726
#7 0x00007ffff5ba3404 in start_thread (arg=0x7ffff238b700) at pthread_create.c:334
#8 0x00007ffff58e102d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
This suggests a runtime thread has wrong signal mask.
The text was updated successfully, but these errors were encountered:
Thanks for the report. This is because gccgo 7 included an old version of the Go runtime package--essentially a copy of the Go 1.4 code. This is fixed in the upcoming gccgo version 8. Closing because there are no plans to backport these extensive changes to GCC 7.
What version of Go are you using (
go version
)?go version go1.8.1 gccgo (GCC) 7.2.1 20170821 linux/amd64
Does this issue reproduce with the latest release?
It doesn't reproduce with later gc toolchains:
go version go1.8.5 linux/amd64
go version go1.9.2 linux/amd64
So it seems it's a gccgo issue.
What operating system and processor architecture are you using (
go env
)?What did you do?
(1) Use cgo to mask SIGINT before Go initialize routine runs.
(2) Create a pthread with cgo, to get SIGINTs with
sigwaitinfo
.(3) Run the program (attached) and press Ctrl+C in terminal (or
kill -INT
it).What did you expect to see?
Since the doc of
os/signal
said:The program should work: prints
2
for all SIGINTs, even with GDB debugging it.What did you see instead?
The program exits with status 130. With GDB the stack backtrace is:
This suggests a runtime thread has wrong signal mask.
The text was updated successfully, but these errors were encountered: