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
exit!
incorrectly calls exit handlers
#6379
Comments
See https://stackoverflow.com/q/63664574/2988 for a discussion. |
I've read that Stack Overflow - but there's something missing here. There are specs for it jruby/spec/ruby/shared/process/exit.rb Lines 95 to 99 in f138bd9
but unlike what the Stack Overflow says, they don't seem to be tagged
and the continuous-integration tests are passing. So there's something else going on. Possibly, it is excluded so it isn't being run in the first place? I'd be surprised if they aren't running slow specs anywhere. Line 42 in f138bd9
|
This appears to be an issue already fixed on master, probably due to reworks of the shutdown logic that have happened this year. JRuby 9.2.13.0 does indeed exhibit the behavior you reported:
On master, the script behaves as it does in CRuby:
In addition, all relevant
I believe we can call this fixed for 9.3. The remaining question is whether a fix should be provided on the 9.2 branch, in case we have additional 9.2.x maintenance releases before 9.3 is done (likely). @rjattrill Did you run into this in an existing application or library, or did you just happen to notice the missing behavior? In short, what's the impact to you of us not releasing a fix until JRuby 9.3? |
Thank you @headius for asking about the impact. The problem arose for us in an existing application that we have installed with customers. We are looking for a shortcut to close down our application. We have actors running in celluloid that we can't terminate easily. Our app has memory leaks in some contexts and so we are now cycling it manually. Due to our production and QA cycles it would take us approximately 2 or 3 months to include a new release of JRuby in our product - so if 9.3.0 is just a few months away there is no point. However, assuming 9.3.0 is more than a few months away, then if it is not too hard to patch this into the next 9.2 maintenance release then that would be very much appreciated. Either way - thank you for fixing this. |
I believe the PR that actually fixed this was #6212. That PR was intended to reorder the teardown sequence to fix #6212 where we were shutting down the background thread pool used for Along the way to fixing that, I noticed that we were installing a JVM shutdown hook to "make sure" we tear down the main JRuby runtime at JVM shutdown. This led to a deadlock in the new logic, since a hard I believe we could fix this for 9.2.14 by just removing the shutdown hook. There's no good reason for us to force a teardown if someone requests a hard exit, and obviously doing so is causing us to run teardown logic when we should not. @enebo What do you think about the impact to 9.2 behavior if we cherry-pick c941c41 over there for 9.2.14? |
I have created #6395 in case we decide the impact to 9.2 is ok. |
Environment Information
Expected Behavior
Kernel::exit!
should not fire exit handlers as per this documentation:https://ruby-doc.org/core-2.7.1/Kernel.html#method-i-exit-21
For example this script:
should produce no output and terminate. MRI behaves as expected.
Actual Behavior
The actual output is this:
The text was updated successfully, but these errors were encountered: