cpu核心卡在100%的CPU利用率上

时间:2017-11-16 11:03:04

标签: java tomcat infinite-loop cpu-usage

我在部署在具有2个核心的aws上的tomcat中运行java Web应用程序。问题是,每隔2-3天,两个CPU核心卡在100%的CPU利用率上,应用程序变得非常慢。当cpu被卡住100%时,通过在10秒间隔内获取tomcat的三个线程转储,我找到了导致问题的两个线程。这是堆栈跟踪。

Thread 1 :

http-bio-8080-exec-10 - priority:10 - threadId:0x00007fda4005a800 - nativeId:0x526e - state:RUNNABLE
stackTrace:
java.lang.Thread.State: RUNNABLE
at org.apache.coyote.http11.AbstractInputBuffer.nextRequest(AbstractInputBuffer.java:229)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1110)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
- locked <0x00000000f4102c60> (a org.apache.tomcat.util.net.SocketWrapper)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

2nd thread : 

http-bio-8080-exec-3 - priority:10 - threadId:0x00007fda24096800 - nativeId:0x524e - state:RUNNABLE
stackTrace:
java.lang.Thread.State: RUNNABLE
at org.apache.coyote.http11.AbstractInputBuffer.nextRequest(AbstractInputBuffer.java:229)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1110)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
- locked <0x00000000f4102ca0> (a org.apache.tomcat.util.net.SocketWrapper)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

如何解决问题。

1 个答案:

答案 0 :(得分:0)

症状看起来像这个Tomcat bug:

解决方案是将Tomcat更新为更新版本。

  

评论#5 - Mark Thomas 2015-02-06 18:03:54 UTC

     

这已在trunk(9.0.x开发)中修复,8.0.x用于8.0.19及7.0.x用于7.0.60以后。