Bug 863307 - changing CATALINA_PID causes tomcat not to start up
Summary: changing CATALINA_PID causes tomcat not to start up
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: tomcat
Version: 17
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Ivan Afonichev
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-10-05 03:44 UTC by Ade Lee
Modified: 2012-12-20 15:56 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-12-20 15:56:02 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ade Lee 2012-10-05 03:44:20 UTC
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 20:59:08 UTC
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-22 02:02:47 UTC
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 15:56:04 UTC
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.