You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/07/01 16:37:44 UTC

svn commit: r1498485 - in /tomcat/tc7.0.x/trunk: ./ bin/catalina.sh webapps/docs/changelog.xml

Author: markt
Date: Mon Jul  1 14:37:43 2013
New Revision: 1498485

URL: http://svn.apache.org/r1498485
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54013
Give forced stop a short period (5s) to complete before returning.
Patch provided by mukarram.baig

Modified:
    tomcat/tc7.0.x/trunk/   (props changed)
    tomcat/tc7.0.x/trunk/bin/catalina.sh
    tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml

Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
  Merged /tomcat/trunk:r1498482

Modified: tomcat/tc7.0.x/trunk/bin/catalina.sh
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/bin/catalina.sh?rev=1498485&r1=1498484&r2=1498485&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/bin/catalina.sh (original)
+++ tomcat/tc7.0.x/trunk/bin/catalina.sh Mon Jul  1 14:37:43 2013
@@ -469,6 +469,7 @@ elif [ "$1" = "stop" ] ; then
     fi
   fi
 
+  KILL_SLEEP_INTERVAL=5
   if [ $FORCE -eq 1 ]; then
     if [ -z "$CATALINA_PID" ]; then
       echo "Kill failed: \$CATALINA_PID not set"
@@ -477,9 +478,22 @@ elif [ "$1" = "stop" ] ; then
         PID=`cat "$CATALINA_PID"`
         echo "Killing Tomcat with the PID: $PID"
         kill -9 $PID
-        rm -f "$CATALINA_PID" >/dev/null 2>&1
-        if [ $? != 0 ]; then
-          echo "Tomcat was killed but the PID file could not be removed."
+        while [ $KILL_SLEEP_INTERVAL -ge 0 ]; do
+            kill -0 `cat "$CATALINA_PID"` >/dev/null 2>&1
+            if [ $? -gt 0 ]; then
+                rm -f "$CATALINA_PID" >/dev/null 2>&1
+                if [ $? != 0 ]; then
+                    echo "Tomcat was killed but the PID file could not be removed."
+                fi
+                break
+            fi
+            if [ $KILL_SLEEP_INTERVAL -gt 0 ]; then
+                sleep 1
+            fi
+            KILL_SLEEP_INTERVAL=`expr $KILL_SLEEP_INTERVAL - 1 `
+        done
+        if [ $KILL_SLEEP_INTERVAL -gt 0 ]; then
+            echo "Tomcat has not been killed completely yet. The process might be waiting on some system call or might be UNINTERRUPTIBLE."
         fi
       fi
     fi

Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1498485&r1=1498484&r2=1498485&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Mon Jul  1 14:37:43 2013
@@ -196,6 +196,11 @@
         (kkolinko)
       </update>
       <fix>
+        <bug>54013</bug>: When using a forced stop, allow a short period of time
+        (5s) for the process to die before returning. Patch provided by
+        mukarram.baig. (markt)
+      </fix>
+      <fix>
         <bug>55119</bug>: Ensure that the build process produces Javadoc that is
         not vulnerable to CVE-2013-1571. Based on a patch by Uwe Schindler.
         (markt)



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org