aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sigqueue.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/sigqueue.go')
-rw-r--r--src/runtime/sigqueue.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/runtime/sigqueue.go b/src/runtime/sigqueue.go
index 4b97745a23..a760790396 100644
--- a/src/runtime/sigqueue.go
+++ b/src/runtime/sigqueue.go
@@ -154,5 +154,14 @@ func signal_disable(s uint32) {
// This runs on a foreign stack, without an m or a g. No stack split.
//go:nosplit
func badsignal(sig uintptr) {
+ // Some external libraries, for example, OpenBLAS, create worker threads in
+ // a global constructor. If we're doing cpu profiling, and the SIGPROF signal
+ // comes to one of the foreign threads before we make our first cgo call, the
+ // call to cgocallback below will bring down the whole process.
+ // It's better to miss a few SIGPROF signals than to abort in this case.
+ // See http://golang.org/issue/9456.
+ if sig == _SIGPROF && needextram != 0 {
+ return
+ }
cgocallback(unsafe.Pointer(funcPC(sigsend)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig))
}