You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Daniel Migowski <dm...@ikoffice.de> on 2015/05/04 12:58:44 UTC
startStopThreads=2 lets Tomcat kill my threads
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.
Regards,
Daniel Migowski
IKOffice
UNTERNEHMENSSOFTWARE
IKOffice GmbH
Daniel Migowski
Mail:
dmigowski@ikoffice.de<ma...@ikoffice.de>
Marie-Curie-Straße 1
Tel.:
+49 (0)441 21 98 89 52
26129 Oldenburg
Fax.:
+49 (0)441 21 98 89 55
http://www.ikoffice.de<http://www.ikoffice.de/>
Mob.:
+49 (0)176 22 31 20 76
Geschäftsführer:
Ingo Kuhlmann, Daniel Migowski
Amtsgericht Oldenburg:
HRB 201467
Steuernummer:
64/211/01864
Re: startStopThreads=2 lets Tomcat kill my threads
Posted by Konstantin Kolinko <kn...@gmail.com>.
2015-05-04 13:58 GMT+03:00 Daniel Migowski <dm...@ikoffice.de>:
> 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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org