Bug 47699 - CATALINA_PID can be over-written by failed start
CATALINA_PID can be over-written by failed start
Product: Tomcat 6
Classification: Unclassified
Component: Native:Integration
PC Windows Server 2003
: P2 normal (vote)
: default
Assigned To: Tomcat Developers Mailing List
Depends on:
  Show dependency tree
Reported: 2009-08-17 05:59 UTC by Mark Thomas
Modified: 2009-11-03 16:25 UTC (History)
0 users

Combined patch (4.14 KB, application/octet-stream)
2009-09-02 10:04 UTC, Mark Thomas

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Thomas 2009-08-17 05:59:59 UTC
If CATALINA_PID is defined and start is called twice in succession CATALINA_PID will be over-written by second start (that will fail as the ports are in use). This will leave the PID file referencing the wrong PID.

This could be fixed be preventing a start if the PID file already exists. This requires adding code to remove the PID file on successful stop. Since the stop command returns before the process exits, some form of timeout is necessary.

Patch to follow shortly.
Comment 1 Mark Thomas 2009-08-17 06:05:10 UTC
This has been fixed in trunk and proposed for 6.0.x
Comment 2 Mark Thomas 2009-09-02 10:04:31 UTC
Created attachment 24202 [details]
Combined patch

The attach patch combines the 3 trunk patches into a single patch.
Comment 3 Mark Thomas 2009-11-03 16:25:01 UTC
This has been fixed in 6.0.x and will be included in 6.0.21 onwards.