-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/cgo: panic from cgo due to signal can't be caught #3774
Labels
Milestone
Comments
I think we may need to crash the program if cgo code gets a synchronous signal. I think the only other plausible alternative would be to throw an exception in the signal handler and catch it in some new function invoked by asmcgocall, but that would add even more overhead to every cgo call for a very minimal benefit. Anything else seems like it might leave the non-Go code in an inconsistent state. |
We could do that, but it would mean that the non-Go code would have no chance to do any cleanups. In the general case it might be left holding locks, not freeing memory, etc. I don't think it's a good idea to simply assume that the non-Go code is OK after a synchronous signal and to just keep running the program. I think we could assume that it is OK if we throw a signal, since that will run any destructors; I don't think we could assume it is OK if we don't do that. |
It's still required to kill it reliably (not call defers, not run concurrently with GC). It's required to check that sigprof/sigqueue do not do allocations, and perhaps add warning comments. And there is also related issue that crash in cgo produces misleading crash reports: https://golang.org/issue/3797 |
OK, while I am looking at sigqueue :) https://golang.org/issue/4383 |
This issue was closed by revision b0a29f3. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: