-
-
Notifications
You must be signed in to change notification settings - Fork 86
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
libev engine has inconsistent handling of signals that raise an exception on the main thread #134
Comments
The specific issue is not that the signal causes the selector to wake up, but that the behavior is inconsistent. It seems like something internal to Ruby is getting into an unexpected state if we can exit with a status code indicating a SIGTERM without raising the correct SignalException. |
I agree that consistent signal handling behavior is desirable. The correct way to handle this in libev would be to wrap its own signal handling behavior: Handling forks is especially tricky. From the libev docs:
|
I confirmed that I can reproduce this with |
The tl;dr: of the libev advice is to install a fork handler (i.e. https://lwn.net/Articles/415684/ From the post, it looks like it should hopefully provide "best effort" treatment of the signal mask, at least on Linux, and should work with
|
I was also able to repro outside the tests where I don't even I'm using this for a relatively low-concurrency application so it appears that I could use the pure Ruby backend as a short term mitigation. You mention here that the Ruby backend should only be used under "exceptional circumstances". Do you think it's a reasonable choice for event loops that handle <<100 monitors? |
Ah sorry, commented from my work account andrew-stripe == metcalf |
You can certainly try to use it, although I'd definitely like to get the libev backend fixed. |
Just wondering where we are at with this. Do we have a test case to reproduce the bug? |
When sending a signal that raises an exception (e.g SIGTERM) while waiting on a NIO
select
on the main thread, behavior is either:This only reproduces with libev. My test fails for Java because I'm using
fork
which isn't supported in JRuby.You can see this reproduced in: #133
The text was updated successfully, but these errors were encountered: