Bug 54013

Summary: Catalina.sh force kill to wait till process exits completely
Product: Tomcat 7 Reporter: mukarram.baig
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: enhancement CC: mukarram.baig
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Attachments: Patch for changes to catalina.sh to wait till process dies completely

Description mukarram.baig 2012-10-16 09:21:49 UTC
Created attachment 29490 [details]
Patch for changes to catalina.sh to wait till process dies completely

In Tomcat 7, when the container is stopped using catalina.sh stop force, the catalina.sh script uses the CATALINA_PID environment variable to send a kill -9 to the pid of the currently running container process. However, this doesn't kill the process instantaneously - say for e.g. when the process is in the middle of a system call or is in the UNINTERRUPTIBLE state. In this case, why cant we use the kill -0 ``cat "$CATALINA_PID"`` >/dev/null 2>&1 trick of checking the liveness of the process before removing the PID file that is used with stop in the non-force mode? This would ensure that the stop force is somewhat synchronous. Just wanted to know if there are good reasons why this was not done. If we don't see any issue with this, I am attaching a patch (to catalina.sh) that is intended to do this. Let me know if there are any questions.

Thanks in advance!
Comment 1 Mark Thomas 2012-10-26 19:37:52 UTC
Comment on attachment 29490 [details]
Patch for changes to catalina.sh to wait till process dies completely

Fix MIME type
Comment 2 Mark Thomas 2013-07-01 14:38:32 UTC
Thanks for the patch. It has been applied to trunk and 7.0.x and will be included in 7.0.42 onwards.