views:

28

answers:

1

I'm trying to debug a java shutdownhook problem. These shutdown hooks use SIGTERM + a watchdog thread. I suspect either a bug in the watchdog thread or a bug in my serialization process, but can't eliminate the second possibility, since i can't debug (even writing to file), so i'd like to increase the timeout to debug, but i don't know where that value is.

Edit: i'm on ubuntu

A: 

According to /etc/rc.d/rc0.d/S01halt on my Fedora 12 system, it's 2 seconds:

kill_all $"Sending all processes the TERM signal..." -15 $OMITARGS
# No need to sleep and kill -9 if no processes to kill were found
if [ "$?" == 0 ]; then
    sleep 2
    kill_all $"Sending all processes the KILL signal..." -9 $OMITARGS
fi

On Ubuntu (10.04, at least), the code is in /etc/init.d/sendsigs. It waits up to 10 seconds for processes to terminate before sending SIGKILL to any that remain.

Rather than changing the timeout, though, it might be better to try shutting down the app yourself (kill 12345 where 12345 is the app's PID).

Richard Fearn
Kill will not trigger the faulty code. I'm interested in debugging the timeout before killing, so i need more time (and possibly a remote debugger).Anyway, that path doesn't exist in ubuntu.
i30817
there is a similar file:But it doesn't use sleep at all:... log_action_msg "Will now halt" halt -d -f $netdown $poweroff $hddown...I don't know the alt command, how to introduce the aditional delayy but at the same time notify the app that things are shutting down.
i30817
The similar file is : /etc/rc0.d/S90halt
i30817
I've updated my answer to include the Ubuntu location.Are you certain that `kill` won't run the shutdown hooks? `kill <pid>` works for me.
Richard Fearn
I deleted a wrong comment. Using kill doesn't trigger the problem, only shutdown and logoff, sorry.
i30817
This is definitively a bug in the java shutdown.I just introduced a 10 seconds sleep in the file you pointed to(after the for in the sequence and before the if).Java still did not write to file the shutdown (in fact i doubt it ran).
i30817