You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Coty Sutherland <cs...@redhat.com> on 2016/06/28 18:39:08 UTC

Tomcat graceful shutdown inquiry

Hello all,

I've been poking around with the Fedora distribution of tomcat and
noticed that systemd isn't allowing tomcat to gracefully shutdown (it
sends an immediate SIGKILL after the Boostrap stop is called). That
isn't your issue, but in trying to mediate the issue so that session
persistence works as expected, I found that SIGTERM causes tomcat to
gracefully shutdown. Looking at the code of the
org.apache.catalina.startup.Bootstrap.stop() method, I can see that it
hands off to Server.stop() and stops the server by initiating the
shutdown hook, etc. When you send a SIGTERM to tomcat the
org.apache.catalina.core.StandardServer.stopInternal() method is what
handles shutdown and appears to be gracefully stopping the server,
though it goes about the process a bit differently.

My question is, can anyone readily tell me the functional difference
between gracefully handling a SIGTERM and utilizing Bootstrap.stop()?
I'm sure that the Bootstrap.stop() is the preferred method, but is
there any major harm in using SIGTERM? I've compared FINE level
logging on org.apache and both methods seem to get the same result (a
graceful stop).



TIA,
Coty

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


Re: Tomcat graceful shutdown inquiry

Posted by Coty Sutherland <cs...@redhat.com>.
Fantastic. Thanks! :)

On Tue, Jun 28, 2016 at 2:43 PM, Mark Thomas <ma...@apache.org> wrote:
> On 28/06/2016 19:39, Coty Sutherland wrote:
>> Hello all,
>>
>> I've been poking around with the Fedora distribution of tomcat and
>> noticed that systemd isn't allowing tomcat to gracefully shutdown (it
>> sends an immediate SIGKILL after the Boostrap stop is called). That
>> isn't your issue, but in trying to mediate the issue so that session
>> persistence works as expected, I found that SIGTERM causes tomcat to
>> gracefully shutdown. Looking at the code of the
>> org.apache.catalina.startup.Bootstrap.stop() method, I can see that it
>> hands off to Server.stop() and stops the server by initiating the
>> shutdown hook, etc. When you send a SIGTERM to tomcat the
>> org.apache.catalina.core.StandardServer.stopInternal() method is what
>> handles shutdown and appears to be gracefully stopping the server,
>> though it goes about the process a bit differently.
>>
>> My question is, can anyone readily tell me the functional difference
>> between gracefully handling a SIGTERM and utilizing Bootstrap.stop()?
>
> None.
>
>> I'm sure that the Bootstrap.stop() is the preferred method,
>
> Not really.
>
>> but is there any major harm in using SIGTERM?
>
> No.
>
>> I've compared FINE level
>> logging on org.apache and both methods seem to get the same result (a
>> graceful stop).
>
> They are equivalent. If you disable the shutdown port, SIGTERM is the
> only way to gracefully shut down Tomcat.
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

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


Re: Tomcat graceful shutdown inquiry

Posted by Mark Thomas <ma...@apache.org>.
On 28/06/2016 19:39, Coty Sutherland wrote:
> Hello all,
> 
> I've been poking around with the Fedora distribution of tomcat and
> noticed that systemd isn't allowing tomcat to gracefully shutdown (it
> sends an immediate SIGKILL after the Boostrap stop is called). That
> isn't your issue, but in trying to mediate the issue so that session
> persistence works as expected, I found that SIGTERM causes tomcat to
> gracefully shutdown. Looking at the code of the
> org.apache.catalina.startup.Bootstrap.stop() method, I can see that it
> hands off to Server.stop() and stops the server by initiating the
> shutdown hook, etc. When you send a SIGTERM to tomcat the
> org.apache.catalina.core.StandardServer.stopInternal() method is what
> handles shutdown and appears to be gracefully stopping the server,
> though it goes about the process a bit differently.
> 
> My question is, can anyone readily tell me the functional difference
> between gracefully handling a SIGTERM and utilizing Bootstrap.stop()?

None.

> I'm sure that the Bootstrap.stop() is the preferred method,

Not really.

> but is there any major harm in using SIGTERM?

No.

> I've compared FINE level
> logging on org.apache and both methods seem to get the same result (a
> graceful stop).

They are equivalent. If you disable the shutdown port, SIGTERM is the
only way to gracefully shut down Tomcat.

Mark


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