-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Discussion: Interest in segfault-handler #7059
Comments
See #6734. It doesn't print backtraces on SIGSEGV or other fatal signals though, doing that from a signal handler is unsafe. |
@bnoordhuis Unsafe: how so? |
There are only a limited number of things you are allowed to do in a signal handler, see the list of async-signal-safe functions in |
@bnoordhuis Is that a limitation of v8 or something more fundamental? |
It's a pretty fundamental limitation. Think of it like this: a signal arrives at an arbitrary time where the program can be in any state, including inconsistent or bad states. As an example: printf and malloc generally grab locks to ensure proper synchronization. What happens when a signal arrives when the main program is inside a critical section and you try to re-enter that critical section again from the signal handler? Deadlock, data races, data corruption and segfaults are all possible. |
Thanks @bnoordhuis this is really useful so thanks for taking the time. |
Hey @nodejs/ctc
@fresheneesz raised an issue on segfault handler asking if we had discussed handing it over to core ddopson/node-segfault-handler#42 as the info you get for native module failures is a little more informative than the default in node.js.
I am not aware if it has been discussed previously but if it's something of interest then it would be great to make it happen
The text was updated successfully, but these errors were encountered: