web项目启动一段时间后cpu爆满,我把相应线程信息打印出来,求解惑,或者提供个思路

时间:2023-02-21 22:21:06
"WebsocketSelector41" #41 daemon prio=5 os_prio=0 tid=0x170fe400 nid=0x24e4 runnable [0x19cdf000]
   java.lang.Thread.State: RUNNABLE
at java.util.HashSet.iterator(HashSet.java:172)
at sun.nio.ch.Util$3.iterator(Util.java:324)
at org.java_websocket.server.WebSocketServer.run(WebSocketServer.java:294)
at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
- None


"ajp-nio-8012-ClientPoller-0" #74 daemon prio=5 os_prio=0 tid=0x16f71c00 nid=0x1aa4 runnable [0x1b69e000]
   java.lang.Thread.State: RUNNABLE
at sun.nio.ch.WindowsSelectorImpl.resetWakeupSocket0(Native Method)
at sun.nio.ch.WindowsSelectorImpl.resetWakeupSocket(WindowsSelectorImpl.java:473)
- locked <0x0b2533e8> (a java.lang.Object)
at sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:174)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
- locked <0x0b23ac60> (a sun.nio.ch.Util$3)
- locked <0x0b23ac70> (a java.util.Collections$UnmodifiableSet)
- locked <0x0b23abe8> (a sun.nio.ch.WindowsSelectorImpl)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
at org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:785)
at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
- None

"ajp-nio-8012-ClientPoller-1" #75 daemon prio=5 os_prio=0 tid=0x16f72400 nid=0x1b5c runnable [0x1b76f000]
   java.lang.Thread.State: RUNNABLE
at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(WindowsSelectorImpl.java:296)
at sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl.java:278)
at sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:159)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
- locked <0x0b2379d8> (a sun.nio.ch.Util$3)
- locked <0x0b2379e8> (a java.util.Collections$UnmodifiableSet)
- locked <0x0b237960> (a sun.nio.ch.WindowsSelectorImpl)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
at org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:785)
at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
- None

"WebsocketSelector46" #46 daemon prio=5 os_prio=0 tid=0x17100400 nid=0x57c runnable [0x1a11f000]
   java.lang.Thread.State: RUNNABLE
at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(WindowsSelectorImpl.java:296)
at sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl.java:278)
at sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:159)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
- locked <0x0aef1ca8> (a sun.nio.ch.Util$3)
- locked <0x0aef1cb8> (a java.util.Collections$UnmodifiableSet)
- locked <0x0aef1c30> (a sun.nio.ch.WindowsSelectorImpl)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:101)
at org.java_websocket.server.WebSocketServer.run(WebSocketServer.java:290)
at java.lang.Thread.run(Thread.java:745)

   Locked ownable synchronizers:
- None

"NioBlockingSelector.BlockPoller-2" #14 daemon prio=5 os_prio=0 tid=0x15d05c00 nid=0x21ac runnable [0x1583f000]
   java.lang.Thread.State: RUNNABLE
at sun.nio.ch.WindowsSelectorImpl.resetWakeupSocket0(Native Method)
at sun.nio.ch.WindowsSelectorImpl.resetWakeupSocket(WindowsSelectorImpl.java:473)
- locked <0x0a0cc458> (a java.lang.Object)
at sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:174)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
- locked <0x0a0c0550> (a sun.nio.ch.Util$3)
- locked <0x0a0c0560> (a java.util.Collections$UnmodifiableSet)
- locked <0x0a0c04d8> (a sun.nio.ch.WindowsSelectorImpl)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
at org.apache.tomcat.util.net.NioBlockingSelector$BlockPoller.run(NioBlockingSelector.java:339)

   Locked ownable synchronizers:
- None

1 个解决方案

#1


https://groups.google.com/forum/#!topic/idempiere/1G2Rg4luMEo
http://apache-mina.10907.n7.nabble.com/MINA-hogs-the-CPU-100-with-resetWakeupSocket-td41471.html
https://bz.apache.org/bugzilla/show_bug.cgi?id=60030
https://*.com/questions/38895884/high-cpu-load-with-the-jsse-client-poller-on-tomcat-8-5

我个人觉得这个东西无解. 应该是最新版apache mina / apache tomcat 与windows系统不兼容的系统级BUG.
这些个问题我在之前用tomcat6和jdk1.6以及老版本的mina的时候是从未遇到过的.
线程抓取的信息你也看到了, 和业务逻辑无关, 最终消耗CPU的动作是在底层方法上.

但是, 同样的程序部署在linux毫无问题.
所以, 我建议你别使用windows部署这个了.  用linux吧.

#1


https://groups.google.com/forum/#!topic/idempiere/1G2Rg4luMEo
http://apache-mina.10907.n7.nabble.com/MINA-hogs-the-CPU-100-with-resetWakeupSocket-td41471.html
https://bz.apache.org/bugzilla/show_bug.cgi?id=60030
https://*.com/questions/38895884/high-cpu-load-with-the-jsse-client-poller-on-tomcat-8-5

我个人觉得这个东西无解. 应该是最新版apache mina / apache tomcat 与windows系统不兼容的系统级BUG.
这些个问题我在之前用tomcat6和jdk1.6以及老版本的mina的时候是从未遇到过的.
线程抓取的信息你也看到了, 和业务逻辑无关, 最终消耗CPU的动作是在底层方法上.

但是, 同样的程序部署在linux毫无问题.
所以, 我建议你别使用windows部署这个了.  用linux吧.