On 07/08/2012 19:07, Neil Richards wrote:
:
Digging back into its history, I see that it all stems from running java
under 'nohup' (e.g. 'nohup java ProgramWithShutdownHooks&').
'nohup' prevents things being registered against SIGHUP, so trying to do
so causes an exception to be thrown.
When this happens, the Terminator code currently decides that it
shouldn't bother trying to register shutdown hooks for SIGINT or SIGTERM
either.
The result is that shutdown hooks aren't currently run when a java
process run using 'nohup' is sent a SIGINT or SIGTERM signal, because of
the code's (false) assumption that a failure to register a handler for
SIGHUP must mean that the VM is running in -Xrs mode.
I don't think the current observed behaviour in this scenario is either
expected or desirable.
It occurs for both J9 and Hotspot (at least, on my Ubuntu box, bash
shell).
Hope this helps to clarify the scenario.
Thanks for helping to clarify what this issue is about. One thing that
still isn't clear (to me anyway) is whether IAE is really thrown in this
case. I did a quick test on Ubuntu 12.04:
$ nohup strace -f java Test 2> log &
and in the log I see the sigactions as I expected:
[pid 13829] rt_sigaction(SIGHUP, NULL, {SIG_IGN, [], 0}, 8) = 0
[pid 13829] rt_sigaction(SIGINT, NULL, {SIG_DFL, [], 0}, 8) = 0
[pid 13829] rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], 0}, 8) = 0
So I don't think we are actually getting an IllegalArgumentException in
this case. Maybe you are seeing something different?
-Alan.