Re: modified legacy catalina.sh forces kill on every stop

2011-10-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Chad,

On 10/18/2011 5:32 PM, chad.da...@emc.com wrote:
> I'm migrating a 5.5 version of tomcat. Whoever set this up in the 
> first place, modified catalina.sh to make every stop a force.
> Here's the modified stop section of catalina.sh.
> 
> #  Force a shutdown every time. #  if [ $FORCE -eq 1 ]; then if [ !
> -z "$CATALINA_PID" ]; then echo "Killing: `cat $CATALINA_PID`" kill
> -9 `cat $CATALINA_PID` rm $CATALINA_PID else echo "Kill failed:
> \$CATALINA_PID not set" fi #  fi
> 
> I'm hoping to remove this completely during the modification. But 
> I'd like to make a best effort attempt to understand why someone 
> would have done this. Does anyone know of any common reasons, or, 
> shall we say, valid reasons for making this modification?

If your webapp creates non-daemon threads, then the JVM might never
shut down.

You can find that out quite easily: just stop Tomcat in the usual way
(i.e. without using "kill" in that script) and see if the JVM process
completes after a few seconds (how long you should wait depends
entirely on how much work your webapp does on shutdown).

If it doesn't stop after a while, take a thread dump to see what
threads are still running. If there are any non-daemon threads
running, they'll be labelled as such and you can try to trace their
origin.

It might be that your server requires the use of 'kill' -- that would
be too bad. Of course, it would be better to use a script that calls
catalina.sh with the "-force" option instead of modifying the script
to ALWAYS force the shutdown. So, you can still use the upgraded
scripts and enable forcing shutdown if you want.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6d860ACgkQ9CaO5/Lv0PBMjwCffUUlg9d936eyXPy7UZb04uJL
sfQAn1+XIPlmw3Y/hTUsMgOxwvuyB0+6
=ajc9
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



modified legacy catalina.sh forces kill on every stop

2011-10-18 Thread Chad.Davis
I'm migrating a 5.5 version of tomcat.  Whoever set this up in the first place, 
modified catalina.sh to make every stop a force.  Here's the modified stop 
section of catalina.sh.

#  Force a shutdown every time.
#  if [ $FORCE -eq 1 ]; then
if [ ! -z "$CATALINA_PID" ]; then
   echo "Killing: `cat $CATALINA_PID`"
   kill -9 `cat $CATALINA_PID`
   rm $CATALINA_PID
else
   echo "Kill failed: \$CATALINA_PID not set"
fi
#  fi

I'm hoping to remove this completely during the modification.  But I'd like to 
make a best effort attempt to understand why someone would have done this.  
Does anyone know of any common reasons, or, shall we say, valid reasons for 
making this modification?