1

While my tomcat server was up and working, it was not able to server requests from one specific app - the browser would just keep spinning (just at the simple login page itself). No errors. From multiple thread dumps, i see only one this suspicious. There are 100's of the threads sleeping, all same stack trace.

Why would so all these be threads be sleeping at CoyoteAdapter.postParseRequest ?

http-nio-8080-exec-159 - priority:6 - threadId:0x000000000f5f5000 - nativeId:0x658 - state:TIMED_WAITING
stackTrace:
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:754)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
- locked <0x00000007dcc67fe8> (a org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
JGH
  • 15,928
  • 4
  • 31
  • 48
gmb
  • 13
  • 4
  • 1
    Possible duplicate of [100 threads TIMED\_WAITING in tomcat, causing it to stall as total number of threads crosses 200](https://stackoverflow.com/questions/10878983/100-threads-timed-waiting-in-tomcat-causing-it-to-stall-as-total-number-of-thre) – paulsm4 Jul 05 '17 at 23:37

1 Answers1

2

Looking at the tomcat source code, the postParseRequest will sleep if the context is paused, the context gets paused while it is being reloaded.

Looking through your thread dump to see which one is reloading the context, should shed some more light on the issue.

Magnus
  • 7,952
  • 2
  • 26
  • 52
  • Thanks Magnus for pointing out. I was not able to find the evidence of application reload in Thread Dump, however i continued to dig the logs. There was a OOM when the app was getting reloaded. Below are logs. – gmb Jul 11 '17 at 17:07
  • 1
    INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.core.StandardContext.reload Reloading Context with name [/myrepoapp] has started SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run Unexpected death of background thread ContainerBackgroundProcessor[StandardEngine[Catalina]] java.lang.OutOfMemoryError – gmb Jul 11 '17 at 17:08