-
Notifications
You must be signed in to change notification settings - Fork 29.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
SIGSEGV handler causes infinite loop if signal raised from within #25762
Comments
thanks @addaleax for the additional context. Unfortunately I am unable to acknowledge that the description in the doc to be sufficient here - even if we take out the JS handler from the picture, any consumer that embeds libuv, installs a handler for SIGSEGV and succumbs to it will tight loop in the same manner. IMO internal segfaults (and its family) should be handled synchronously. Asynchronous handling looks to be neither feasible, nor meaningful. there is a longer version of the signal handler callback that provides additional context of the signal source and the execution context. IMO that may be used to figure out the signal's background and if it is internal, the callback should be called in line (first before the running through the chain), and the decision on the resumption of execution should be controllable by the embedder. At present no code is at risk, but the problem determination of hard crashes become difficult with the current design. |
@gireeshpunathil Just to clarify, I don’t think it’s possible to do anything meaningful with JS code here – we can’t call that from a signal handler. |
@addaleax - I agree. I was referring to the second level callback that is registered by the embedder - such as a C++ |
@gireeshpunathil you've seen the docs, right? http://docs.libuv.org/en/v1.x/signal.html
|
@sam-github - aren't those windows specific caveats? I would like to consider this is as node bug: Exposing a JS API ( A way to address this:
Examples of the class of issues this could potentially cover as #25814 and #25512 |
Sorry, yes, wrong text. Similar text in node.js docs, though: 'SIGBUS', 'SIGFPE', 'SIGSEGV' and 'SIGILL', when not raised artificially using kill(2), inherently leave the process in a state from which it is not safe to attempt to call JS listeners. Doing so might lead to the process hanging in an endless loop, since listeners attached using process.on() are called asynchronously and therefore unable to correct the underlying problem. ^--- node docs, not windows specific. If its documented behaviour, its not formally a bug.
I think not. Sync signals like the above cannot be ignored or fixed, hoping to continue on executing js under these conditions seems unreasonable. |
@sam-github - agree that the current behavior is documented. However, for me it looks like an explanation to or a warning about an un-natural behavior; does not touch upon:
Just to re-iterate:
thoughts? |
`--diagnostic-report-on-fatalerror` does not capture internal segfaults at present, instead limited to only faults that are detected by the Node / v8. libuv's signal handler deliveres result asynchronously which does not help for SIGSEGV as: i) the synchronous sequence restarts the failing code, ii) due to i) the callback is never delivered to the consumer. Install a SIGSEGV handler in Node and follow the sequence of fatalerror handling, as of now at least under report. Fixes: nodejs#25762
This issue has been open for years but I don't think it's actionable (it just is what it is) so I'm going to go ahead and close it. |
this causes node to loop tight with high CPU. On the first look I was thinking it keeps calling the handler but that was not the case.
in libuv, the signals (internal or external) are intercepted in
uv__signal_handler
.These questions come to my mind:
IMO the embedder should decide / control these?
@nodejs/libuv @nodejs/process
The text was updated successfully, but these errors were encountered: