You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Patrick Plaatje <pa...@ipros.nl> on 2009/03/11 11:02:50 UTC

"hanging" threads on Tomcat

Hi all,

on one of our websites we have a problem with threads keep hanging in 
Tomcat. We first noticed this 1.5 week ago and tried several things to 
find a solution. At that moment we were using java 1.4 and Tomcat 5.0. 
The symptoms were there after three hours of operation, about 250 
threads were hanging within tomcat, and they seemed to be waiting for 
"something".

After a week we realised we needed more information whihc we couldn't 
get from the current setup, we upgraded the three production application 
servers to be Java 1.5 and Tomcat 5.5.25. All three servers still have 
the same problem, although the problem now has an interval of appr. 6 
hours instead of three.

During the hanging of the threads we made 8 threaddumps. But i am unsure 
of how to "read" the thread dumps. A small overview of the state of the 
threads:

- 309 threads overall
- Threads waiting for monitors: 57
- Threads sleeping on monitors: 191
- Threads locking monitors: 225
- Monitors: 225
- Monitors without locking threads: 3

Can somebody please help me figuring out what the cause is, or how to 
find the cause of the problem?

Best regards,

Patrick

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


Re: "hanging" threads on Tomcat

Posted by Oliver Schoett <ol...@capgemini-sdm.com>.
Patrick Plaatje wrote:
> Thanks for the swift replies, i have two dump, appr a few seconds 
> apart uploaded to:
>
> http://www.ipros.nl/uploads/catalina_stripped_1.out
> http://www.ipros.nl/uploads/catalina_stripped_2.out

Many threads appear to be waiting on the same instance of 
org.apache.tomcat.dbcp.pool.impl.GenericObjectPool in 
org.apache.tomcat.dbcp.dbcp.PoolingDataSource.getConnection, while I can 
see only 4 threads actually doing database work.

Is it possible that you have configured too few database connections? 
(If the current limit is 4, try 20.)

A second point of contention looks like

     at neo.util.Mutex.aquire(Mutex.java:77)
     at 
neo.xredsys.presentation.ArticlePresentationManager.getArticle(ArticlePresentationManager.java:200)
     at 
neo.xredsys.presentation.ArticlePresentationManager.getArticle(ArticlePresentationManager.java:169)
     at 
neo.xredsys.presentation.ArticlePresentationManager.getArticle(ArticlePresentationManager.java:149)

But this may be a property of the software you use and harder to change.

Regards,

Oliver Schoett



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


RE: "hanging" threads on Tomcat

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Patrick Plaatje [mailto:patrick@ipros.nl] 
> Subject: Re: "hanging" threads on Tomcat
> 
> Thanks for the swift replies, i have two dump, appr a few 
> seconds apart uploaded to:

You appear to be out of database connections.  This is almost always caused by webapp code not disposing of result sets, statements, and connections properly, leading to exhaustion of the pool.  The proper technique is to insure that every place that obtains a connection also has a finally block that will close all the resources associated with the connection, including the connection itself.

This is a common discussion topic, so you can search the archives for examples.  Also look at the Tomcat doc for recommended practice and how to detect (and work around) lost connections:
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

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


Re: "hanging" threads on Tomcat

Posted by Patrick Plaatje <pa...@ipros.nl>.
Thanks for the swift replies, i have two dump, appr a few seconds apart 
uploaded to:

http://www.ipros.nl/uploads/catalina_stripped_1.out
http://www.ipros.nl/uploads/catalina_stripped_2.out

Thanx,

Patrick


Mark Thomas schreef:
> Patrick Plaatje wrote:
>   
>> Hi all,
>>
>> on one of our websites we have a problem with threads keep hanging in
>> Tomcat. We first noticed this 1.5 week ago and tried several things to
>> find a solution. At that moment we were using java 1.4 and Tomcat 5.0.
>> The symptoms were there after three hours of operation, about 250
>> threads were hanging within tomcat, and they seemed to be waiting for
>> "something".
>>
>> After a week we realised we needed more information whihc we couldn't
>> get from the current setup, we upgraded the three production application
>> servers to be Java 1.5 and Tomcat 5.5.25. All three servers still have
>> the same problem, although the problem now has an interval of appr. 6
>> hours instead of three.
>>
>> During the hanging of the threads we made 8 threaddumps. But i am unsure
>> of how to "read" the thread dumps. A small overview of the state of the
>> threads:
>>
>> - 309 threads overall
>> - Threads waiting for monitors: 57
>> - Threads sleeping on monitors: 191
>> - Threads locking monitors: 225
>> - Monitors: 225
>> - Monitors without locking threads: 3
>>
>> Can somebody please help me figuring out what the cause is, or how to
>> find the cause of the problem?
>>     
>
> You'll need to provide the thread dumps. Rather than all 8, just two ~15s apart
> should suffice.
>
> Mark
>
>   
>> Best regards,
>>
>> Patrick
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>   


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


Re: "hanging" threads on Tomcat

Posted by Mark Thomas <ma...@apache.org>.
Patrick Plaatje wrote:
> Hi all,
> 
> on one of our websites we have a problem with threads keep hanging in
> Tomcat. We first noticed this 1.5 week ago and tried several things to
> find a solution. At that moment we were using java 1.4 and Tomcat 5.0.
> The symptoms were there after three hours of operation, about 250
> threads were hanging within tomcat, and they seemed to be waiting for
> "something".
> 
> After a week we realised we needed more information whihc we couldn't
> get from the current setup, we upgraded the three production application
> servers to be Java 1.5 and Tomcat 5.5.25. All three servers still have
> the same problem, although the problem now has an interval of appr. 6
> hours instead of three.
> 
> During the hanging of the threads we made 8 threaddumps. But i am unsure
> of how to "read" the thread dumps. A small overview of the state of the
> threads:
> 
> - 309 threads overall
> - Threads waiting for monitors: 57
> - Threads sleeping on monitors: 191
> - Threads locking monitors: 225
> - Monitors: 225
> - Monitors without locking threads: 3
> 
> Can somebody please help me figuring out what the cause is, or how to
> find the cause of the problem?

You'll need to provide the thread dumps. Rather than all 8, just two ~15s apart
should suffice.

Mark

> 
> Best regards,
> 
> Patrick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 


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


RE: "hanging" threads on Tomcat

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Patrick Plaatje [mailto:patrick@ipros.nl] 
> Subject: "hanging" threads on Tomcat
> 
> - 309 threads overall
> - Threads waiting for monitors: 57
> - Threads sleeping on monitors: 191
> - Threads locking monitors: 225
> - Monitors: 225
> - Monitors without locking threads: 3

Haven't looked at your thread dumps yet, but you might try using JConsole; it has an interesting looking "Detect Deadlocks" button on the Threads tab that may show you something useful.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

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