You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Glenn Nielsen <gl...@voyager.apg.more.net> on 2001/12/26 18:32:43 UTC

Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup Catalina.java

Remy Maucherat wrote:
> 
> > glenn       01/12/26 03:00:55
> >
> >   Modified:    catalina/src/share/org/apache/catalina/startup
> Catalina.java
> >   Log:
> >   Something changed recently causes the catalina java
> >   process to hang at this point on shutdown unless there is an
> >   explicit System.exit().  Could this have something to do with
> >   the STM changes?
> 
> It does work fine for me. The change is a bad idea anyway, since the
> shutdown is asynchronous (it would be almost equivalent to not attemping to
> shutdown and kill the process).
>

The way I am using Tomcat isn't typical, the instance that fails to
terminate on shutdown is being used as a stand alone soap server which
uses https.  The only web application is the soap server.  It doesn't work
in this case.  This configuration had worked fine with Tomcat 4.0.1. This
is the first time I tried running the soap server with 4.1-dev, I wanted
to test the DbcpDataSourceFactory.

I didn't realize that the container stop was asynchronous, so you are
right, using System.exit() like this is not a good solution.  If you
look at the code you will notice that the comment says FIX ME ???. :-)
I put the System.exit() in as a temp fix.

The only cause I can come up with which would prevent the java process
from terminating is if there are still threads running which weren't
terminated by the stop. Hence the speculation that the problem has something 
to do with the STM changes.

Regards,

Glenn

----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startupCatalina.java

Posted by Glenn Nielsen <gl...@voyager.apg.more.net>.
Glenn Nielsen wrote:
> 
> > Nothing has changed in the soap web application except running it
> > in Tomcat 4.1-dev instead of Tocmat 4.0.1.  Under 4.1-dev the java
> > process fails to terminate on a stop, under 4.0.1 the process terminated
> > normally.
> >
> 
> After playing around with my server.xml config and the soap web app
> web.xml I have isolated the problem down to a <listener> configured in
> the web.xml.  Removing the <listener> config fixes the problem.
> >From looking at the list of Threads in the main ThreadGroup, if a listener
> is configured there is an additional thread created that is never destroyed
> or setDaemon().  The listener class itself does not use threads.
> 

Ok, _my mistake_, the session listener configured does start a background
thread.  Updating the code for starting that thread to use setDaemon(true)
fixed the problem with Tomcat 4.1-dev shutting down.

But the behavior of how non Daemon threads are handled at shutdown must
have changed between Tomcat 4.0.1 and Tomcat 4.1-dev.

Thanks,

Glenn

----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startupCatalina.java

Posted by Glenn Nielsen <gl...@voyager.apg.more.net>.
Glenn Nielsen wrote:
> 
> "Craig R. McClanahan" wrote:
> >
> > On Wed, 26 Dec 2001, Glenn Nielsen wrote:
> >
> > >
> > > I did some more testing, and Apache soap 2.2 might be causing Tomcat 4.1-dev
> > > to exhibit this behaviour.  Again, this behaviour is not seen with Tomcat 4.0.1.
> > > If I comment out the config for that Context, Tocmat shutsdown normally.
> > > I grepped through the soap source and it does not implement the
> > > SingleThreadModel.
> > >
> > > I set debug="99" in server.xml and compared start/stop of Tomcat 4.0.1
> > > and 4.1-dev.
> > >
> > > The only difference I found in the logs were the additional lines below
> > > from the Tomcat 4.1-dev start/stop, indicated with a *:
> > >
> > >
> > > 2001-12-26 12:30:39 HostConfig[localhost]: HostConfig: Processing START
> > > * 2001-12-26 12:30:39 HostConfig[localhost]:  Starting background thread
> > > * 2001-12-26 12:30:39 HostConfig[localhost]: BACKGROUND THREAD Starting
> > > 2001-12-26 12:30:39 HostConfig[localhost]: Deploying discovered web applications
> > > 2001-12-26 12:30:51 HostConfig[localhost]: HostConfig: Processing STOP
> > > * 2001-12-26 12:30:51 HostConfig[localhost]:  Stopping background thread
> > > * 2001-12-26 12:30:51 HostConfig[localhost]: BACKGROUND THREAD Stopping
> > > 2001-12-26 12:30:51 HostConfig[localhost]: Undeploying deployed web applications
> > >
> > > I also added some code to Catalina.java for thread debug purposed in Tomcat 4.1-dev,
> > > here is the list of ThreadGroups after waiting 10 seconds for Tomcat to stop:
> > >
> > > Catalina.stop active threads: 3
> > > java.lang.ThreadGroup[name=main,maxpri=10]
> > >     Thread[main,5,main]
> > >     Thread[Thread-0,5,main]
> > >     Thread[Thread-1,5,main]
> > >
> >
> > Looks like some background threads are not getting created as daemons.
> > HostConfig calls thread.setDaemon(true) after creating its background
> > thread (as well as setting the thread name), so it doesn't look like that
> > is the culprit.
> >
> 
> Right, I saw that as I was looking through the code to see where threads
> were created.
> 
> > Does Apache SOAP try to create background threads without cleaning them
> > up afterwards?  Or, maybe the XML parser it's using?
> >
> 
> Nothing has changed in the soap web application except running it
> in Tomcat 4.1-dev instead of Tocmat 4.0.1.  Under 4.1-dev the java
> process fails to terminate on a stop, under 4.0.1 the process terminated
> normally.
> 

After playing around with my server.xml config and the soap web app
web.xml I have isolated the problem down to a <listener> configured in
the web.xml.  Removing the <listener> config fixes the problem.
>From looking at the list of Threads in the main ThreadGroup, if a listener
is configured there is an additional thread created that is never destroyed 
or setDaemon().  The listener class itself does not use threads.

Getting closer.

Regards,

Glenn

----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startupCatalina.java

Posted by Glenn Nielsen <gl...@voyager.apg.more.net>.
"Craig R. McClanahan" wrote:
> 
> On Wed, 26 Dec 2001, Glenn Nielsen wrote:
> 
> >
> > I did some more testing, and Apache soap 2.2 might be causing Tomcat 4.1-dev
> > to exhibit this behaviour.  Again, this behaviour is not seen with Tomcat 4.0.1.
> > If I comment out the config for that Context, Tocmat shutsdown normally.
> > I grepped through the soap source and it does not implement the
> > SingleThreadModel.
> >
> > I set debug="99" in server.xml and compared start/stop of Tomcat 4.0.1
> > and 4.1-dev.
> >
> > The only difference I found in the logs were the additional lines below
> > from the Tomcat 4.1-dev start/stop, indicated with a *:
> >
> >
> > 2001-12-26 12:30:39 HostConfig[localhost]: HostConfig: Processing START
> > * 2001-12-26 12:30:39 HostConfig[localhost]:  Starting background thread
> > * 2001-12-26 12:30:39 HostConfig[localhost]: BACKGROUND THREAD Starting
> > 2001-12-26 12:30:39 HostConfig[localhost]: Deploying discovered web applications
> > 2001-12-26 12:30:51 HostConfig[localhost]: HostConfig: Processing STOP
> > * 2001-12-26 12:30:51 HostConfig[localhost]:  Stopping background thread
> > * 2001-12-26 12:30:51 HostConfig[localhost]: BACKGROUND THREAD Stopping
> > 2001-12-26 12:30:51 HostConfig[localhost]: Undeploying deployed web applications
> >
> > I also added some code to Catalina.java for thread debug purposed in Tomcat 4.1-dev,
> > here is the list of ThreadGroups after waiting 10 seconds for Tomcat to stop:
> >
> > Catalina.stop active threads: 3
> > java.lang.ThreadGroup[name=main,maxpri=10]
> >     Thread[main,5,main]
> >     Thread[Thread-0,5,main]
> >     Thread[Thread-1,5,main]
> >
> 
> Looks like some background threads are not getting created as daemons.
> HostConfig calls thread.setDaemon(true) after creating its background
> thread (as well as setting the thread name), so it doesn't look like that
> is the culprit.
> 

Right, I saw that as I was looking through the code to see where threads
were created.

> Does Apache SOAP try to create background threads without cleaning them
> up afterwards?  Or, maybe the XML parser it's using?
> 

Nothing has changed in the soap web application except running it
in Tomcat 4.1-dev instead of Tocmat 4.0.1.  Under 4.1-dev the java
process fails to terminate on a stop, under 4.0.1 the process terminated
normally.

Regards,

Glenn

----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup Catalina.java

Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Wed, 26 Dec 2001, Glenn Nielsen wrote:

>
> I did some more testing, and Apache soap 2.2 might be causing Tomcat 4.1-dev
> to exhibit this behaviour.  Again, this behaviour is not seen with Tomcat 4.0.1.
> If I comment out the config for that Context, Tocmat shutsdown normally.
> I grepped through the soap source and it does not implement the
> SingleThreadModel.
>
> I set debug="99" in server.xml and compared start/stop of Tomcat 4.0.1
> and 4.1-dev.
>
> The only difference I found in the logs were the additional lines below
> from the Tomcat 4.1-dev start/stop, indicated with a *:
>
>
> 2001-12-26 12:30:39 HostConfig[localhost]: HostConfig: Processing START
> * 2001-12-26 12:30:39 HostConfig[localhost]:  Starting background thread
> * 2001-12-26 12:30:39 HostConfig[localhost]: BACKGROUND THREAD Starting
> 2001-12-26 12:30:39 HostConfig[localhost]: Deploying discovered web applications
> 2001-12-26 12:30:51 HostConfig[localhost]: HostConfig: Processing STOP
> * 2001-12-26 12:30:51 HostConfig[localhost]:  Stopping background thread
> * 2001-12-26 12:30:51 HostConfig[localhost]: BACKGROUND THREAD Stopping
> 2001-12-26 12:30:51 HostConfig[localhost]: Undeploying deployed web applications
>
> I also added some code to Catalina.java for thread debug purposed in Tomcat 4.1-dev,
> here is the list of ThreadGroups after waiting 10 seconds for Tomcat to stop:
>
> Catalina.stop active threads: 3
> java.lang.ThreadGroup[name=main,maxpri=10]
>     Thread[main,5,main]
>     Thread[Thread-0,5,main]
>     Thread[Thread-1,5,main]
>

Looks like some background threads are not getting created as daemons.
HostConfig calls thread.setDaemon(true) after creating its background
thread (as well as setting the thread name), so it doesn't look like that
is the culprit.

Does Apache SOAP try to create background threads without cleaning them
up afterwards?  Or, maybe the XML parser it's using?

> Regards,
>
> Glenn

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup Catalina.java

Posted by Glenn Nielsen <gl...@voyager.apg.more.net>.
Remy Maucherat wrote:
> 
> > Remy Maucherat wrote:
> > >
> > > It does work fine for me. The change is a bad idea anyway, since the
> > > shutdown is asynchronous (it would be almost equivalent to not attemping
> to
> > > shutdown and kill the process).
> > >
> >
> > The way I am using Tomcat isn't typical, the instance that fails to
> > terminate on shutdown is being used as a stand alone soap server which
> > uses https.  The only web application is the soap server.  It doesn't work
> > in this case.  This configuration had worked fine with Tomcat 4.0.1. This
> > is the first time I tried running the soap server with 4.1-dev, I wanted
> > to test the DbcpDataSourceFactory.
> >
> > I didn't realize that the container stop was asynchronous, so you are
> > right, using System.exit() like this is not a good solution.  If you
> > look at the code you will notice that the comment says FIX ME ???. :-)
> > I put the System.exit() in as a temp fix.
> 
> I don't think it's a good idea to put something in that you know is broken.
> We might forget about it (esp since there's some vacation to help).
> 

I didn't know stop was asynchronous at the time.

> > The only cause I can come up with which would prevent the java process
> > from terminating is if there are still threads running which weren't
> > terminated by the stop. Hence the speculation that the problem has
> something
> > to do with the STM changes.
> 
> If there's no STM servlets, it shouldn't do that. Also, if you look at the
> code, I don't see why it would cause some problems.
> 
> Is it Apache SOAP ?
> I'll try to look at it if it is.
> 

I did some more testing, and Apache soap 2.2 might be causing Tomcat 4.1-dev
to exhibit this behaviour.  Again, this behaviour is not seen with Tomcat 4.0.1.
If I comment out the config for that Context, Tocmat shutsdown normally.
I grepped through the soap source and it does not implement the
SingleThreadModel.

I set debug="99" in server.xml and compared start/stop of Tomcat 4.0.1
and 4.1-dev.

The only difference I found in the logs were the additional lines below 
from the Tomcat 4.1-dev start/stop, indicated with a *:


2001-12-26 12:30:39 HostConfig[localhost]: HostConfig: Processing START
* 2001-12-26 12:30:39 HostConfig[localhost]:  Starting background thread
* 2001-12-26 12:30:39 HostConfig[localhost]: BACKGROUND THREAD Starting
2001-12-26 12:30:39 HostConfig[localhost]: Deploying discovered web applications
2001-12-26 12:30:51 HostConfig[localhost]: HostConfig: Processing STOP
* 2001-12-26 12:30:51 HostConfig[localhost]:  Stopping background thread
* 2001-12-26 12:30:51 HostConfig[localhost]: BACKGROUND THREAD Stopping
2001-12-26 12:30:51 HostConfig[localhost]: Undeploying deployed web applications

I also added some code to Catalina.java for thread debug purposed in Tomcat 4.1-dev,
here is the list of ThreadGroups after waiting 10 seconds for Tomcat to stop:

Catalina.stop active threads: 3
java.lang.ThreadGroup[name=main,maxpri=10]
    Thread[main,5,main]
    Thread[Thread-0,5,main]
    Thread[Thread-1,5,main]

Regards,

Glenn
----------------------------------------------------------------------
Glenn Nielsen             glenn@more.net | /* Spelin donut madder    |
MOREnet System Programming               |  * if iz ina coment.      |
Missouri Research and Education Network  |  */                       |
----------------------------------------------------------------------

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/startup Catalina.java

Posted by Remy Maucherat <re...@apache.org>.
> Remy Maucherat wrote:
> >
> > It does work fine for me. The change is a bad idea anyway, since the
> > shutdown is asynchronous (it would be almost equivalent to not attemping
to
> > shutdown and kill the process).
> >
>
> The way I am using Tomcat isn't typical, the instance that fails to
> terminate on shutdown is being used as a stand alone soap server which
> uses https.  The only web application is the soap server.  It doesn't work
> in this case.  This configuration had worked fine with Tomcat 4.0.1. This
> is the first time I tried running the soap server with 4.1-dev, I wanted
> to test the DbcpDataSourceFactory.
>
> I didn't realize that the container stop was asynchronous, so you are
> right, using System.exit() like this is not a good solution.  If you
> look at the code you will notice that the comment says FIX ME ???. :-)
> I put the System.exit() in as a temp fix.

I don't think it's a good idea to put something in that you know is broken.
We might forget about it (esp since there's some vacation to help).

> The only cause I can come up with which would prevent the java process
> from terminating is if there are still threads running which weren't
> terminated by the stop. Hence the speculation that the problem has
something
> to do with the STM changes.

If there's no STM servlets, it shouldn't do that. Also, if you look at the
code, I don't see why it would cause some problems.

Is it Apache SOAP ?
I'll try to look at it if it is.

Remy


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>