-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Roger,

On 8/27/20 14:43, Roger Marquis wrote:
> Mark Thomas wrote:
>> Those are all application issues. The application should shut
>> itself down cleanly. Tomcat is complaining because it hasn't.
>
> I don't know Mark, most Java/Tomcat engineers expect an application
> to shutdown when it's os/container/shell/parent shuts-down.  Can
> you help us understand why Tomcat is different in this respect than
> say Apache httpd?

Along with Mark's reply, there is also the fact that httpd doesn't
really run "applications" per se. If you are using something like
mod_php or CGI, then that's all ephemeral: once the request is done,
the child process dies. Or, more specifically, the child process exits
and that's what causes the response to be sent to the client.

There is little to no notion of cross-request state in httpd.
Requesting httpd to stop sends a signal to the primary httpd process
which tells all its children to stop. If there is a problem with a
child (e.g. it's processing a request, or stuck in some way), the
primary process has to decide what to do about it. It may be able to
SIGKILL it. Maybe not, depending upon process privileges (though the
primary process usually runs as root, so it should be able to do that).

For threaded MPMs, the primary or child process can choose what to do
about killing the threads that appear stuck. The pthreads library has
a pthread_cancel function which requests that the thread be stopped,
but it does not guarantee anything. This is similar to Java, except
that Java has gone so far as to say "the Thread.stop method should not
be used" (because it is not reliable, it causes weirdness in the JVM,
etc.).

If you want to *kill* the application and it won't shut down on its
own, SIGKILL is the answer. But that's not a great way to shut down an
application /in general/ because the application might want/need to do
something convenient on shutdown (flush caches, save state, etc.).

The previous two paragraphs are mostly valid for both httpd AND
Tomcat. The reason httpd is often "cleaner" than Tomcat sometimes is,
is because of the applications running within Tomcat. httpd is really
a web server, and Tomcat is an application container.

Could Tomcat be more aggressive about killing applications when they
aren't behaving appropriately? Maybe. But then you'd never fix your
application, now would you?

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl9IInAACgkQHPApP6U8
pFi6zw//WBFH087QqzmZbgdQjPxDhZ5f5L9lQmp4VFaw+dOEkP4xNMkGCxWeTq1Z
1nmogFYsZ8vns8z1f8RJ22aDWhdFqCDDHlJkqobR/4d4wiKd0hmjm75s8NH2YeCk
2UwwlStV99n5BNu3/TBTQFyjUv2rhz8cO8tDkztFGS7avXogSm08zeeHgVIC8cWV
tiGBe7QVH/PMeanGl+/1IdWQ5PmpmNpGBv5YGJMYfU9Hmul/GeNW55pLJPSxS7ll
/8thgxDVK4VudnA6MGELVSht56qlEQtlekMJjSUUvagmT94yTDXd7teOagZL9U79
26EL5tOiSkE4GGPoR/jQa0kj0bNMHMUJsBJRoHDCXxQdJhPLTGZNKZM1yMgAlMnc
6D2/acg9TbO6ia0Q1qpQmh2vWUlMPdp4U8X1uP6RdKKQyyjM5Pzinw/ysktgEBpI
lYSI+uz3uG0iJGzqECPaoTpTTtSqdtG68QVqU2Kgv4lHmENNHFWMDKbB3glwqfBN
KLw6fCrKGG6XGdQEcgtR8GjyNNpErLcf7PzIqXtwo9bNoQWNhYF/VjjndRJTTL98
IwoEL9qHXs0hhtKHA4x7kir0OARjwXDNwuJGu9LrKX1qOtzNxUAmjckHtLDjb5m8
nWmsz2zzy1rak1t1EPVsFjfOu5kZL+++IQcXja29uZshuiPcWbI=
=vc24
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to