tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hubert Rabago <>
Subject Re: Shutdown process hanging when I load-on-startup
Date Thu, 16 Sep 2004 19:56:12 GMT
On Thu, 16 Sep 2004 15:33:47 -0400, Shapira, Yoav <> wrote:
> Hi,
> Please keep the discussion on the list, not person.  It might benefit
> others now in the future, from the archives.

Hmm... did not know I did that.  I just hit reply on Gmail and I
didn't check the To field.

> >From what I can tell, my servlet#destroy() method is being called,
> >because I shut down the JMS connections and the ActiveMQ broker from
> >there.
> >
> >I'm just running Tomcat through the startup/shutdown batch files
> provided.
> The most common cause for this is non-daemon threads started by you (or
> one of the libraries you use) that aren't shutting down.  The JVM can't
> shut those down for you, and the JVM process can't exit (so Tomcat can't
> unbind the port) until those threads are eliminated.

As it turns out, though, this is also what was happening to me. 
Apparently I had a bug in my "shut-down-the-broker" code where I set a
flag to a wrong value and it didn't really shut it down.  UGH.  I hate
it when this happens.

See, I knew if I had non-daemon threads that it would cause issues
when I shut down the container, because I had this issue with apps I
The reason I thought I got it right all this time was because of my
previous experience, in that if I didn't shut down the thread, I
expected my tomcat console to stay.  Like I said in my original post,
if I didn't have "load-on-startup", it shut down anyway.  Hmm. 

But at this point, I'm just glad it's working, and that's another bug
cleaned out of my code.

> To debug further, you should issue a SIGQUIT (or CTRL-BREAK on windows)
> to the JVM process when Tomcat "hangs."  You will see what threads are
> doing, and that should show you which ones are causing the hang.  If
> you're having trouble interrupting the thread dump, post it here and
> we'll try to help.

Last time around, I added a context listener (or did I do this on a
destroy()?) which queried Thread.enumerate() when I shut down.  I
wasn't aware of the ctrl-break trick.  This is nice to know.  I'll
note this down the next time I insist that "I'm shutting down my
threads properly" or I inherit another app with stubborn threads.

> Yoav

Thanks for the help!!!  


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message