-
Notifications
You must be signed in to change notification settings - Fork 18k
runtime: linking a c-shared library disables the C main() SIGINT handler #13028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
To make this report more self contained, here is the readme from https://github.com/glycerine/cshared-osx-issue cshared-osx-issueWith go 1.5.1 and at tip, I'm seeing what looks like a bug when c-shared .so libraries that do signal.Notify(c, os.Interrupt) are loaded in a host program that handles SIGINT itself. Update: tried with tip on OSX and linux, go version devel +79a3b56 Thu Oct 22 21:19:43 2015 +0000 darwin/amd64, and I see the same thing. Possibly related: #11794 ###Discussion: When I am building a c-shared dynamic library with golang code, it looks I was led to investigate because when I loaded This repo is an attempt to reduce/isolate that issue into a minimal test case. I've not been successful yet in reproducing the difference between OSX and Linux, and I suspect this is due to variation in the signal handling code either in the Golang runtime or the R runtime. Nonethless, while I cannot reproduce the crash/panic in a minimal test case (it reproduces easily in you want to go to the trouble of doing an R source install and compiling my R library 'rmq'), I do observe that signal handling under OSX and linux appears to be disabled by loading the golang based c-shared library, and I strongly suspect that this is a part of the mechanism of the crash. Moreover it seems like a bug in its own right. I think this is related to #11794. detailson darwin-amd64 / OSX 10.10.5 Yosemite: The places below where you see "C-c C-c" is where I give Ctrl-c to
The same thing happens on fedora22 linux amd64, go1.5.1. And at tip 79a3b56.
the originating (and more elaborate) problem: the panic stack traceHere is the stack trace from the crash when running under R on OSX. Source code is here: https://github.com/glycerine/rmq The above code is a minimal test case for this more elaborate issue found in context of running under R.
|
I'm seeing a race between the SIGINT reset coming from the cshared lib, and setting it in main. If I put a sleep(1) at the top of main before signal(SIGINT, handleInterrupt) call, then main wins and the handleInterrupt() gets called back on ctrl-c. Without the sleep, the main's signal() call goes before the reset from the cshared lib, and main's setting is wiped out.
|
To scope down the two concerns here, I opened #13034 to focus on the OSX-only sefault when sending SIGINT. |
CL https://golang.org/cl/17903 mentions this issue. |
I'm seeing behavior suspiciously similar to the closed issue #11794
I reproduced this is a minimal test case, full details in a repo here https://github.com/glycerine/cshared-osx-issue
I tried tip as well as go1.5.1, the hijacking still occurs on both OSX and linux.
The text was updated successfully, but these errors were encountered: