Bug 700581

Summary: initscript status incorrect with multiple instances, CATALINA_PID not respected
Product: [Fedora] Fedora Reporter: John Dennis <jdennis>
Component: tomcat6Assignee: David Knox <dknox>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 15CC: dknox, dwalluck, jclere, sochotni
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tomcat6-6.0.32-8.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-30 19:44:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
reimplement status command, respect CATALINA_PID none

Description John Dennis 2011-04-28 17:48:19 UTC
There are two fundamental problems with the status command.

1) It reports a tomcat instance as running when the instance isn't
running and reports pids which do not belong to the instance.

2) It does not respect the CATALINA_PID file variable which is set in
the per instance config file and instead hardcodes the pid file to
/var/run/${NAME}.pid

Problem 1 occurs when there are multiple tomcat instances on the
system. The status command checks for the presence of
/var/run/${NAME}.pid, if the pid file is not present it is supposed to
indicate the instance is stopped. But instead if /var/run/${NAME}.pid
is not present it uses pgrep to search the process table for any
java process running with the TOMCAT_USER uid and gid. When there are
multiple instances pgrep will return a list of pids for each
instance. However, none of those instances are the instance whose
status we're checking. Thus it reports the instance is running, but
that is not correct, the instance is not running but other instances
are and it's those instances whose pid's are reported.

Problem 2 occurs whenever the instance config does not use the same
pid file default encoded in the initscript. For example we group our
pids in a subdirectory of /var/run specific to the application.

Ideally we would like to use the lsb status command and not implement
the status command in our initscript. However the lsb status command
takes as one of it's arguments the process name. However we don't know
the process name because it's set in the wrapper via set_javacmd and
that process name is not known in the initscript. Attached is a patch
which reimplements the status command following the LSB guidelines,
and respects the CATALINA_PID variable.

Comment 1 John Dennis 2011-04-28 17:51:02 UTC
Created attachment 495617 [details]
reimplement status command, respect CATALINA_PID

Comment 2 John Dennis 2011-04-28 18:36:37 UTC
As a reference this problem was observed in bug #689858, that bug now depends on this bug.

Comment 3 Fedora Update System 2011-05-16 18:53:06 UTC
tomcat6-6.0.32-1.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/tomcat6-6.0.32-1.fc15

Comment 4 Fedora Update System 2011-05-17 05:38:01 UTC
Package tomcat6-6.0.32-1.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing tomcat6-6.0.32-1.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/tomcat6-6.0.32-1.fc15
then log in and leave karma (feedback).

Comment 5 Fedora Update System 2011-05-18 21:40:09 UTC
tomcat6-6.0.32-2.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/tomcat6-6.0.32-2.fc15

Comment 6 Fedora Update System 2011-07-05 17:51:36 UTC
tomcat6-6.0.32-4.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/tomcat6-6.0.32-4.fc15

Comment 7 Fedora Update System 2011-09-27 22:25:17 UTC
tomcat6-6.0.32-8.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/tomcat6-6.0.32-8.fc15

Comment 8 Fedora Update System 2011-09-27 22:26:50 UTC
tomcat6-6.0.32-17.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/tomcat6-6.0.32-17.fc16

Comment 9 Fedora Update System 2011-10-19 04:35:36 UTC
tomcat6-6.0.32-17.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2011-10-20 09:57:42 UTC
tomcat6-6.0.32-8.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.