Hello Resin Buddies,

I've been tracking down a problem we're having running Resin 3.0.21 for integration testing (part of a Maven-based build) on our Mac OS X development machines. For some reason, Resin often doesn't shut down properly after the tests complete, leaving both the wrapper.pl and JVM processes running. (I understand that the wrapper.pl script has now been replaced by a Java watchdog process in Resin 3.1.x, but we're still using 3.0.21.) In this state, I'm also unable to terminate them via a "kill -15 <wrapperPID>" on the command line.

As I understand it, when the wrapper.pl script receives an INT(2), KILL(9), QUIT(3), or TERM(15) signal it tries to let its child, the JVM process, die gracefully by closing the keepalive socket linking them. It waits for 60 seconds to see whether this works (note: $kill_time is 60):

    if ($child > 0) {
        $time = $kill_time;
        # let it die gracefully in 60 seconds
        while ($time-- > 0 and kill(0, $child)) {

If the child is still running after 60 seconds, it tries the (somewhat platform-dependent and confusingly documented) kill(-$child) for another 60 seconds:

        if ($time <= 0) {
            $time = $kill_time;

            while ($time-- > 0 and kill(-$child)) {

If the child is still running after the second 60 seconds, it wants to try the more drastic kill(-9, $child):

        if ($time < 0) {
            print("Resin proc $child did not die, using kill -9");

            kill(-9, $child);


Unfortunately, I don't think that ($time < 0) check is ever going to return true, since the while ($time-- > 0 and ...) loop should terminate with $time equal to 0 if the 60 seconds run out. Note the difference between this check and the previous one.

Thus, my reading of wrapper.pl suggests that it will *never* try to kill the JVM process via kill -9, so if Perl's funky kill(-$child) thing doesn't work (doesn't seem to help on Mac OS X), then both the wrapper.pl script and the JVM will be left running.

Does the analysis above make sense?

- Chris
Chris Schneider
Krugle, Inc.
resin-interest mailing list

Reply via email to