Misbehaving exit status from Hotspot

Charles Oliver Nutter headius at headius.com
Tue Jul 3 21:56:05 UTC 2018


On Sat, Jun 30, 2018 at 1:20 AM, John Rose <john.r.rose at oracle.com> wrote:
> I'm sympathetic with what you want to do, but I would be scared to just change
> the behavior of the VM in response to a signal, even in this relatively innocuous
> way.  Surely something out there will break.

And I am sympathetic to breaking something. To be honest, at this
point the discussion is mostly academic for me...I want to understand
why things are the way they are beyond "because that's how we've
always done it." I believe I understand the reasons better now.

> My next thought is to throw in a -XX:+DoSignalsCharliesWay flag (not its real
> name).  The objection to that is that it adds an obscure corner to our testing
> matrix.  Not insuperable, but it's not something our test harnesses are well
> designed for.
>
> BTW, why doesn't -Xrs work for you?  That's certainly closer to the mark.
> Is it that you want to run some JRuby shutdown hooks and then trap out
> (rather than exit)?  If so, I suppose you want some sort of -Xrs0.5.

I don't think we use exit hooks at all in JRuby (or at least not the
built-in support for it in the JDK) so -Xrs may be an acceptable
answer for limited cases.

> Underneath this stuff is a very simple API called JVM_handle_linux_signal.
> This is the 'secret identity' of all the JVM's signal handlers.  If you know this
> identity, then perhaps you can set your own signal handler in its place,
> and delegate everything to JVM_handle_linux_signal.  Here's the signal
> handler HotSpot uses for *all signals*:

Yeah that would be another option. We do have a native JRuby
executable that directly boots libjvm and goes from there. That would
be an opportunity to register our own top-level TERM handler that does
what I want.

> Sorry it's not a simpler answer…

It never is :-)

I don't agree with how Hotspot handles this, but I'm willing to grant
that it's not a big enough difference to warrant changing it. At this
point I'll be going back to my users (and the JRuby FAQ) to let folks
know this is just the way it is, and the justification for it. They
probably won't agree either, but my hands are kinda tied.

- Charlie


More information about the hotspot-runtime-dev mailing list