Bug 62117

Summary: catalina.sh contains misleading error message
Product: Tomcat 8 Reporter: mark.morschhaeuser
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Severity: minor    
Priority: P2    
Version: 8.5.x-trunk   
Target Milestone: ----   
Hardware: PC   
OS: Linux   

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