tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Randall <>
Subject Re: Scripted shutdown does not force JVM exit
Date Sat, 01 Jan 2005 23:10:02 GMT
Hi Tim, QM, thanks for your replies.

Tim Funk:
> Calling System.exit() has been discussed on
tomcat-dev and by vetoed.

Yes, thanks, I subsequently found zilla 17000 and the

Tim Funk:
> If the JVM does not shut down - it is due to bad 3rd
party code which creates non-daemon threads and fail
to detect a shutdown.

As put in my original post, I totally agree that it is
bad form by the webapp to start a long-running Thread
and not shut it down during its own shutdown.

> I'd disagree; it puts responsibility on developers
and architects to make sure their applications handle
threads properly.

Yes, responsibility has been placed on developers and
architects, but a Tomcat admin who deploys
applications may not be in a position to hold them all
individually to account.

Tim Funk:
> Then if you need to kill the JVM  - just "kill -9

Yes, bearing in mind that SIGKILL is a very blunt
instrument.  It will prevent the JVM from running any
shutdown hooks or finalizers.  SIGHUP seems to work OK
on Linux, but the way the JVM responds to signals from
the OS seems to vary.  For this reason, I think
"killing from the outside" is bad and should be
avoided if at all possible.

> There's no need for a container to compensate for
poor design. =)

Agreed, but wouldn't you agree that said poor design
of a webapp should not cause (unnecessary) problems
with administration of the container?  Important to
remember that not all Tomcat admins write the webapp
code.  Source code is often not available.

I think this can be argued from the other perspective:
 the container is already compensating for poor design
in the webapp, by allowing stray threads to continue
running.  Shutdown means shutdown, which should give
the container the right to terminate the JVM, no?


Note that the shutdown sequence in a default 3.2.x
jBoss deployment does finally shutdown the JVM.

+1 for the (configurable) enhancement described in
17000, based on the fact that System.exit(0) is better
than "killing from the outside", in circumstances
beyond the Tomcat Administrator's control (when a
webapp misbehaves by leaving unterminated threads).  I
see no good reason to delegate this part of the
shutdown sequence to the operating system.

Happy to see any arguments for -1.

Brett Randall

Find local movie times and trailers on Yahoo! Movies.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message