Bug 863307 - changing CATALINA_PID causes tomcat not to start up
changing CATALINA_PID causes tomcat not to start up
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: tomcat (Show other bugs)
17
All Linux
unspecified Severity high
: ---
: ---
Assigned To: Ivan Afonichev
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-04 23:44 EDT by Ade Lee
Modified: 2012-12-20 10:56 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-12-20 10:56:02 EST
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)

  None (edit)
Description Ade Lee 2012-10-04 23:44:20 EDT
Description of problem:

In /usr/sbin/tomcat-sysd, in the start() function, we have the following code:

function start() {
    # fix permissions on the log and pid files
    export CATALINA_PID="/var/run/${NAME}.pid"
    touch $CATALINA_PID 2>&1
    if [ "$?" -eq "0" ]; then
      chown ${TOMCAT_USER}:${TOMCAT_USER} $CATALINA_PID
    fi
...

This hard codes CATALINA_PID, ignoring any customizations that might have been made in /etc/sysconfig/${NAME}.

The code goes in to read /etc/sysconfig/${NAME} in parseOptions and pass any customized variables to the invocation of TOMCAT_SCRIPT.  This results in the server failing to come up because it the pid file at the customized location does not exist and the TOMCAT_USER does not have the permissions to create it.

The solution is straight forward.  In the code above, we should replace:

export CATALINA_PID="/var/run/${NAME}.pid"

with:

export CATALINA_PID="${CATALINA_PID:-/var/run/${NAME}.pid}"

This will read the correct value from /etc/sysconfig/${NAME} if it exists, or default to /var/run/{NAME}.pid

Version-Release number of selected component (if applicable):

tomcat-7.0.29-1.fc17.noarch on Fedora 17 
This is not a problem on F18.

How reproducible:


Steps to Reproduce:
1. Choose a different location for CATALINA_PID in /etc/sysconfig/{NAME}
2. Try to start the server using systemd 
  
Actual results:
Server will fail to come up with a permissions error for the pid file, which will not be created in the custom location.

Expected results:

Server comes up and creates pid file where we tell it to.

Additional info:
Comment 1 Fedora Update System 2012-10-19 16:59:08 EDT
tomcat-7.0.32-1.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/tomcat-7.0.32-1.fc17
Comment 2 Fedora Update System 2012-10-21 22:02:47 EDT
Package tomcat-7.0.32-1.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing tomcat-7.0.32-1.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-16618/tomcat-7.0.32-1.fc17
then log in and leave karma (feedback).
Comment 3 Fedora Update System 2012-12-20 10:56:04 EST
tomcat-7.0.32-1.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

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