Bug 62117 - catalina.sh contains misleading error message
Summary: catalina.sh contains misleading error message
Alias: None
Product: Tomcat 8
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 8.5.x-trunk
Hardware: PC Linux
: P2 minor (vote)
Target Milestone: ----
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2018-02-19 13:17 UTC by mark.morschhaeuser
Modified: 2018-02-19 15:58 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description mark.morschhaeuser 2018-02-19 13:17:56 UTC
catalina.sh contains the following snippet:
kill -0 `cat "$CATALINA_PID"` >/dev/null 2>&1
if [ $? -gt 0 ]; then
    echo "PID file found but no matching process was found. Stop aborted."
    exit 1

Sending the signal 0 to a given PID checks if 
- any process with the given PID is running *and*
- you have the permission to send a signal to it.

Now assume the tomcat process was running as root and the catalina.sh is executed as user tomcat. Then the file $CATALINA_PID exists (as well as the process) but kill -0 returns an error because the tomcat user has no permissions to kill the root process.
So the message is incomplete, thus misleading.

The error message should instead be like
"PID file found but either no matching process was found or no permission to stop the process. Stop aborted."

This problem not only exists in Tomcat 8.x but also in the source trunk and in Tomcat 9.
Comment 1 Mark Thomas 2018-02-19 15:58:36 UTC
Thanks for reporting this. I've updated the message.

Fixed in:
- trunk for 9.0.6 onwards
- 8.5.x for 8.5.29 onwards
- 8.0.x for 8.0.51 onwards
- 7.0.x for 7.0.86 onwards