> -----Original Message----- > From: Rainer Jung [mailto:rainer.j...@kippdata.de] > Sent: Monday, May 18, 2009 2:43 PM > To: Tomcat Users List > Subject: Re: Running out of tomcat threads - why many threads in RUNNABLE > stage even with no activity > > Yes, those two look like "waiting for next request on an existing > connection from the web server to Tomcat" and "sitting idle in the pool, > waiting for a new connection to handle". >
[Pantvaidya, Vishwajit] Thanks Rainier. Any idea why threads would be sitting around in Runnable state even when nobody has been using application for a long time. From whatever I have read on this, it seems to me that this could happen if a servlet writes something to a response stream, closes the response stream, but after that keeps on doing some processing (e.g. running an infinite loop). I am reasonably sure that our app is not doing something like that. Unless there was something like an infinite loop running in a servlet, I would assume that the servlet would eventually return and the tomcat TP-Processor thread would be released back to the connection pool (go into Waiting state). > On 18.05.2009 22:44, Pantvaidya, Vishwajit wrote: > >>> [Pantvaidya, Vishwajit] Here are figures from 3 of the servers which > > > >> have > > > >>> not yet run out of threads (so the thread count does not add up to > 200). > > > >> I > > > >>> have taken these late at night when no users are present, so I was > > > >>> expecting all threads to be Waiting for tomcat thread-pool. > > > > > >>> 1. Total TP-Processor threads 48, Waiting 46, Runnable 2 > > > >>> 2. Total TP-Processor threads 40, Waiting 29, Runnable 11 > > > >>> 3. Total TP-Processor threads 120, Waiting 7, Runnable 113 > > > > > > > > [Pantvaidya, Vishwajit] Since Rainer mentioned that he would like to see > more of the stack trace, here are the complete stack traces for a Runnable > and Waiting thread from #3 above. All Runnable/Waiting threads from all > the above cases have same stack trace as below: > > > > > > > > "TP-Processor119" - Thread t...@2294 > > > > java.lang.Thread.State: RUNNABLE > > > > at java.net.SocketInputStream.socketRead0(Native Method) > > > > at java.net.SocketInputStream.read(SocketInputStream.java:129) > > > > at > java.io.BufferedInputStream.fill(BufferedInputStream.java:218) > > > > at > java.io.BufferedInputStream.read1(BufferedInputStream.java:256) > > > > at > java.io.BufferedInputStream.read(BufferedInputStream.java:313) > > > > at > org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:607) > > > > at > org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:545) > > > > at > org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:67 > 2) > > > > at > org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.ja > va:876) > > > > at > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.j > ava:684) > > > > at java.lang.Thread.run(Thread.java:595) > > > > > > > > "TP-Processor118" - Thread t...@2293 > > > > java.lang.Thread.State: WAITING on > org.apache.tomcat.util.threads.threadpool$controlrunna...@3579cafe > > > > at java.lang.Object.wait(Native Method) > > > > at java.lang.Object.wait(Object.java:474) > > > > at > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.j > ava:656) > > > > at java.lang.Thread.run(Thread.java:595) > > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org