Tomcat server freezes and stops responding completely. Restart seem to be the only way to bring it back online. Thread dump showed that server maxed out on AJP threads. I have default value (200) set for maxThread, and I saw exactly 200 AJP threads in "RUNNABLE" and "locked on monitor" state when my server hung. This issue typically happens once every 3 to 4 days. The server is not loaded heavily, it's serving one request every 5 min or so. Is this some kind of ajp-thread leak issue?
Server is unable to create new AJP threads once it reaches max-limit on number AJP threads, I can understand that's the expected behavior. But what I am struggling to understand is
- Why the server keep creating new AJP thread for serving new requests when "RUNNABLE" ajp threads are available in the pool?
Did anyone experience similar issue? Is this a know issue/bug in Tomcat? Appreciate your help!
Thread Dump snippet of AJP-Thread: (I can post complete thread dump if anyone like to look at it... please let me know)
"ajp-bio-6109-exec-307" daemon prio=10 tid=0x00007f846d3bc800 nid=0x51c9 runnable [0x00007f842e4e3000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at org.apache.coyote.ajp.AjpProcessor.read(AjpProcessor.java:316)
at org.apache.coyote.ajp.AjpProcessor.readMessage(AjpProcessor.java:371)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:128)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
- locked <0x00000007b4f6f9a8> (a org.apache.tomcat.util.net.SocketWrapper)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Thanks