Am 12.04.2015 um 02:20 schrieb HG:
Every once in a while we get the following (Tomcat 6)

Mar 31, 2015 7:24:32 PM org.apache.tomcat.util.threads.ThreadPool logFull
SEVERE: All threads (200) are currently busy, waiting. Increase
maxThreads (200) or check the servlet status

in the Catalina logs and server stops responding. The server is used
very lightly and number of concurrent users not anywhere near 200 (2-3
on a busy day)

The thread dump shows 199 of these:

"TP-Processor200" daemon prio=10 tid=0x00002b513c31b000 nid=0x1c44
runnable [0x00002b514a9a7000]
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:258)
     at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
     - locked <0x00000007873208a0> (a java.io.BufferedInputStream)
     at org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:628)
     at org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:566)
     at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:693)

     at
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:898)

     at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)

     at java.lang.Thread.run(Thread.java:662)

and one of

"TP-Processor4" daemon prio=10 tid=0x00002b513c21a000 nid=0x7470 in
Object.wait() [0x00002b5135520000]
java.lang.Thread.State: WAITING (on object monitor)
     at java.lang.Object.wait(Native Method)
     - waiting on <0x0000000784a7a208> (a
org.apache.tomcat.util.threads.ThreadPool)
     at java.lang.Object.wait(Object.java:485)
     at
org.apache.tomcat.util.threads.ThreadPool.findControlRunnable(ThreadPool.java:339)

     - locked <0x0000000784a7a208> (a
org.apache.tomcat.util.threads.ThreadPool)
     at
org.apache.tomcat.util.threads.ThreadPool.runIt(ThreadPool.java:314)
     at
org.apache.jk.common.ChannelSocket.acceptConnections(ChannelSocket.java:676)

     at
org.apache.jk.common.ChannelSocket$SocketAcceptor.runIt(ChannelSocket.java:879)

     at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)

     at java.lang.Thread.run(Thread.java:662)

Can anybody figure out why it complaints about busy threads when they
are clearly not?

The first 199 are connected to a fronting web server and wait for requests on their connections.

You are using a blocking connector implementation. That means each web server to Tomcat connection needs on eexclusive thread to handle it. It does not matter whether the connection already has an in-flight request on it or is completely idle. The thread is exclusively working for this single connection. Once your Tomcat has as manyconnections open in parallel as your thread pool size (or n-1), it can not accept any more connections and will log the observed message.

Your can choose a mix of the following optimizations:

- increase your thread pool size

- configure Tomcat and for web server (Apache/mod_jk, Apache/mod_proxy_ajp, ...) to shut down idle connections more aggressively to free Tomcat threads - lower idle connection timeout (Tomcat keep alive timeout and e.g. mod_jk connection_pool_timeout) - lower the number of connections, that will be kept alive even if they are idle for a long time (mod_jk connectiopn_pool_min_size)

- switch to a non blocking connector implementation like NIO. There the threads are not blocked during the time the connections are idle. Idle connections are monitored by (few, e.g. 1) poller threads and only connections with in-flight requests need a normal thread pool thread.

- Make sure your web servers are not oversized in terms of their own capability on how many connections in parallel they will provide

Regards,

Rainer

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

Reply via email to