-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
Raising SIGTERM SignalException returns wrong process exit code #5134
Comments
This is most likely a bug. I believe we are only looking for |
Ok, I pushed a simple fix for this to master. It should be producing the right return codes for SignalException now. @perlun I don't think there's a spec for this. Can you add one? |
Fixed for 9.2. |
We found a case in JRuby where this was not working as expected: jruby/jruby#5134 This spec describes the expected behavior in this scenario. It works on MRI, but fails on the currently released JRuby version (because of the bug, which is fixed in jruby master.)
@headius Thank you for that! In return, I added the spec that you suggested: ruby/spec#596 (It works on MRI but fails on jruby 9.1.16.0. Haven't tested with jruby master, but running |
We found a case in JRuby where this was not working as expected: jruby/jruby#5134 This spec describes the expected behavior in this scenario. It works on MRI, but fails on the currently released JRuby version (because of the bug, which is fixed in jruby master.)
I tested now with
These issues are closely related, but they probably are in the |
(This was originally spotted in puma/puma#1558, thanks @dekellum for great help there.)
With JRuby 9.1.16.0 on Java 8 (on latest macOS), I get this:
Same with JRuby 1.7 actually:
However, with MRI 2.5.1 I get this:
...which is indeed the correct value for a
SIGTERM
-triggered exit of a process.As inspired by #5049, I tried another approach also which worked slightly differently:
Here be the surprise: JRuby behaves differently, and even differently than the
raise SignalException, "SIGTERM"
scenario.Exit code 0 is not entirely correct, but it's at least much better than exit code 1 which indicates failure. 😄
Inspired by this Oracle article linked to from the JRuby wiki, I tested with the
-Xrs
parameter:So that makes the
Process.kill
approach work just like MRI, which is good (so we have a decent enough workaround for that.) However, theraise SignalException, 'SIGTERM'
still gives the seemingly incorrect exit code.Is this by design or is it a bug?
The text was updated successfully, but these errors were encountered: