tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <>
Subject Re: startStopThreads=2 lets Tomcat kill my threads
Date Mon, 04 May 2015 14:14:08 GMT
2015-05-04 13:58 GMT+03:00 Daniel Migowski <>:
> Hello,
> I have an application deployed to a Tomcat 8.0.5 which uses the ServletContextListener
to do something when Tomcat stops. This task takes about 45 seconds. This wasn't a problem
until I learned that I could speed up the Tomcat 8 startup time by parallel instantiation
of my webapps by adding the startStopThreads attribute to the Host tag in the server.xml.
> Now, when Tomcat stops, it seems to interrupt or stop my Thread, because it doesn't print
out anything anymore (even a System.out.println isn't shown in the log so I don't think it
is because just log4j is stopped). Why does Tomcat wait nicely with startStopThreads removed,
and why can't he wait when I use startStopThreads? The behavior of killing webapps the hard
way when using startStopThreads isn't documented also.

There is no such feature as killing an app that has
ServletContextListener that is running.

If ServletContextListener has spawned additional threads and does not
wait for them, they may die naturally when web application classloader
stops (as they cannot load any more classes beyond that point).

Memory leak prevention code may kill threads, but only if you
explicitly configure it to do so. But default it just prints
diagnostic messages about those.

There exist configurable 'unloadDelay' property on Context.

The current version of Tomcat 8 is 8.0.21.  Whatever your
several-years-old 8.0.5 does -- hardly anyone remembers now. You may
read the mailing list archives from several years ago.

Best regards,
Konstantin Kolinko

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

View raw message