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

Guido,

On 12/5/18 10:46, Jäkel, Guido wrote:
>> Does it really ? If some tomcat code is at that time processing
>> a client POST request, which potentially modifies data on the
>> server (or a back-end database), is ditto tomcat code "informed"
>> of the JVM shutdown, and does it have time to interrupt the
>> processing in some predictable/recoverable way ?
> 
> In no other way than a Tomcat worker get informed about a Tomcat 
> shutdown if you trigger this event e.g. by the shutdown port 
> mechanism or JXM. OT a feature of Tomcat is that it will first
> stop accepting new requests by the connectors and let the servlet 
> containers stop the applications afterwards. Therefore, a started 
> request will be finished. And after all request workers are idle,
> the worker pool will terminate.
> 
> If you send a signal to a process, nothing is "interrupted" but
> just a consumer in the process get signaled - that's why it's
> called this way. And that's the reason why a process might not stop
> if you send a SIGTERM to it. It's just a request to please the
> process to terminate by itself. Some signals are handled outside
> the process, for simplification let's say by the process scheduler.
> If one send a SIGKILL, the scheduler will "hard kill" the process
> (and it's threads) at any point of execution path and just recover
> the reserved resources.

This is exactly correct.

It's often surprising to people when they find out that a SIGTERM can
initiate a "graceful" shutdown of a running JVM. I think most people
thing that SIGTERM and SIGKILL are roughly the same thing.

It's an instructive thought-experiment to consider that most
*NIX-style init systems send SIGTERM signals to all process as they
are shutting-down the operating system. This doesn't "terminate" the
processes (as the signal name might suggest), but rather "requests
that they self-terminate" where the process gets to decide how to shut
itself down.

It's only SIGKILL (or some of the hardware-generated signals like
SIGBUS) that will simply end a process without any notification or
anything else.

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

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlwH9KIACgkQHPApP6U8
pFic6Q/9EYOtfxeUnkLX76joeNYShpdlWhmATzHCHeW/jalATsrtZood0xVLzJze
Aw9yvYx1mdeOeJ0UyD9puv4/cOnI9dEsKgO4FMu3TjO6S9ern3sgK8bgJlVqI1Tf
dI4STGhfRDS0L8E6a6oyWDPpCmRgtLre67KFQFd6aAczSe9YxzSlLEp+eyBv3DXa
RjC/TDDHPi+dnJJKB7geOdZgv/Apso+z1c2CpZKGvud1m93S994NY2hQxuRTEXZ5
q6TWd/XarsuvcEOoU+4Jg6WX0ccqNF3AaTz5N0uAMcI+ZKAsc+6nQH65staOYEn3
9OFmBjNTZxXAD+7iJz2u2sk6REgHyvyhueqwwLDqM+FB4e0eQgLoq6dOhR0GegUD
IHAAgJ7jcpy5wOGZPHFg6DBONg+eiWHaRIrCQZQmS8OcALK5ZsasRHnWit7HdL4k
GJcC1jnXmIiK6ukRCil/GKusYVXvkDAhKkKcJ/Mwq2RqHamM4Gi2zkwKvq8oLnj8
XvW2SStOneVyw2o7e5KxfVOGRw+hmjflKh9XhzN4cmjsFzgK1uCaEU9SidmwC27c
8nXeZVBZYdLWW7Fixcisr5WZWSxYTJYOgQAfV4w4iP+q/kJYlz9af1VOeh584Wrd
PMzldJcFQ9sYAWe5IF8g+uO9rlP31fjY806t6oovjlbq7BRSZxE=
=pzVr
-----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