Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1347860 - The systemd service unit does not allow tomcat to shut down gracefully
The systemd service unit does not allow tomcat to shut down gracefully
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: tomcat (Show other bugs)
7.2
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Coty Sutherland
Michal Karm Babacek
:
Depends On: 1347864
Blocks: 1298191 1347142
  Show dependency treegraph
 
Reported: 2016-06-17 17:06 EDT by Coty Sutherland
Modified: 2016-11-03 17:14 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1347864 (view as bug list)
Environment:
Last Closed: 2016-11-03 17:14:01 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
small test app to reproduce behavior (215 bytes, application/zip)
2016-06-17 17:06 EDT, Coty Sutherland
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2599 normal SHIPPED_LIVE Moderate: tomcat security, bug fix, and enhancement update 2016-11-03 08:12:12 EDT

  None (edit)
Description Coty Sutherland 2016-06-17 17:06:17 EDT
Created attachment 1169239 [details]
small test app to reproduce behavior

Description of problem:
The systemd unit terminates the tomcat process prematurely, therefore not allowing it to shutdown gracefully. The direct effect of this is that sessions in the session manager are not persisted to disk and restored after a restart, resulting in a loss of session data (unless you are replicating data within a cluster).

Version-Release number of selected component (if applicable):
tomcat-7.0.54-1.el7.noarch

How reproducible:
Always

Steps to Reproduce:
1. yum install tomcat
2. cp reproducer.war /usr/share/tomcat/webapps/
3. service tomcat start
4. curl http://localhost:8080/reproducer/getSession.jsp
5. service tomcat stop
6. ls /usr/share/tomcat/work/Catalina/localhost/reproducer/SESSIONS.ser

Actual results:
The session created by the curl request is not persisted into SESSIONS.ser.

Expected results:
The session created by the curl request is persisted to SESSIONS.ser

Additional info:
When the process successfully completes (with FINE logging on the StandardManager (org.apache.catalina.session.StandardManager.level = FINE)), you see the following along with other shutdown messages:

~~~
Jun 17, 2016 4:45:08 PM org.apache.catalina.session.StandardManager doUnload
FINE: Unloading persisted sessions
Jun 17, 2016 4:45:08 PM org.apache.catalina.session.StandardManager doUnload
FINE: Saving persisted sessions to SESSIONS.ser
Jun 17, 2016 4:45:08 PM org.apache.catalina.session.StandardManager doUnload
FINE: Unloading 4 sessions
Jun 17, 2016 4:45:08 PM org.apache.catalina.session.StandardManager doUnload
FINE: Expiring 4 persisted sessions
Jun 17, 2016 4:45:08 PM org.apache.catalina.session.StandardManager doUnload
FINE: Unloading complete
~~~

When you call the service stop, it terminates before the shutdown can complete (almost immediately after calling stop):

~~~
INFO: Server startup in 3501 ms
Jun 17, 2016 4:58:20 PM org.apache.catalina.core.StandardServer await
INFO: A valid shutdown command was received via the shutdown port. Stopping the Server instance.
Jun 17, 2016 4:58:20 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
~~~
Comment 1 Coty Sutherland 2016-06-17 17:07:02 EDT
I'm able to get a graceful shutdown if I switch the unit type to Forking instead of simple, but then the start hangs :(
Comment 7 errata-xmlrpc 2016-11-03 17:14:01 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2016-2599.html

Note You need to log in before you can comment on or make changes to this bug.