dragonwell-project / dragonwell8

Alibaba Dragonwell8 JDK
http://dragonwell-jdk.io
GNU General Public License v2.0
4.22k stars 498 forks source link

[Bug] cpu usage 高到40%, 下不来 #686

Open bbili opened 1 month ago

bbili commented 1 month ago

Description 开启协程的服务, 出现cpu飙升后, 即使服务摘流了, 也没有看到cpu利用率下来.

JDK version

java -version
openjdk version "1.8.0_302"
OpenJDK Runtime Environment (Alibaba Dragonwell 8.8.8) (build 1.8.0_302-b01)
OpenJDK 64-Bit Server VM (Alibaba Dragonwell 8.8.8) (build 25.302-b01, mixed mode)

Execution environment

[arthas@1065195]$ thread -n 3
"Wisp-Root-Worker-4" Id=8 cpuUsage=41.11% deltaTime=88ms time=45983512ms RUNNABLE
    at sun.misc.Unsafe.unpark0(Native Method)
    at sun.misc.Unsafe.access$100(Unsafe.java:45)
    at sun.misc.Unsafe$1.unpark0(Unsafe.java:60)
    at com.alibaba.wisp.engine.WispScheduler$Worker.doSignalIfNecessary(WispScheduler.java:217)
    at com.alibaba.wisp.engine.WispScheduler$Worker.signal(WispScheduler.java:258)
    at com.alibaba.wisp.engine.WispScheduler.tryPush(WispScheduler.java:322)
    at com.alibaba.wisp.engine.WispScheduler.signalIdleWorkerToHelpSteal(WispScheduler.java:450)
    at com.alibaba.wisp.engine.WispScheduler.access$1600(WispScheduler.java:43)
    at com.alibaba.wisp.engine.WispScheduler$SchedulingPolicy$1.enqueue(WispScheduler.java:415)
    at com.alibaba.wisp.engine.WispScheduler.executeWithWorkerThread(WispScheduler.java:404)
    at com.alibaba.wisp.engine.WispCarrier.wakeupTask(WispCarrier.java:304)
    at com.alibaba.wisp.engine.WispCarrier$1.run(WispCarrier.java:360)
    at com.alibaba.wisp.engine.WispScheduler.doExec(WispScheduler.java:536)
    at com.alibaba.wisp.engine.WispScheduler.access$600(WispScheduler.java:43)
    at com.alibaba.wisp.engine.WispScheduler$Worker.runCarrier(WispScheduler.java:161)
    at com.alibaba.wisp.engine.WispScheduler$Worker.run(WispScheduler.java:137)
    at java.lang.Thread.run(Thread.java:853)

"Wisp-Root-Worker-10" Id=14 cpuUsage=40.76% deltaTime=87ms time=46051964ms RUNNABLE
    at sun.misc.Unsafe.park0(Native Method)
    at sun.misc.Unsafe.access$200(Unsafe.java:45)
    at sun.misc.Unsafe$1.park0(Unsafe.java:65)
    at com.alibaba.wisp.engine.WispScheduler$Worker.doParkOrPolling(WispScheduler.java:188)
    at com.alibaba.wisp.engine.WispScheduler$Worker.runCarrier(WispScheduler.java:170)
    at com.alibaba.wisp.engine.WispScheduler$Worker.run(WispScheduler.java:137)
    at java.lang.Thread.run(Thread.java:853)

"Wisp-Root-Worker-12" Id=16 cpuUsage=40.4% deltaTime=86ms time=46007158ms RUNNABLE
    at sun.misc.Unsafe.park0(Native Method)
    at sun.misc.Unsafe.access$200(Unsafe.java:45)
    at sun.misc.Unsafe$1.park0(Unsafe.java:65)
    at com.alibaba.wisp.engine.WispScheduler$Worker.doParkOrPolling(WispScheduler.java:188)
    at com.alibaba.wisp.engine.WispScheduler$Worker.runCarrier(WispScheduler.java:170)
    at com.alibaba.wisp.engine.WispScheduler$Worker.run(WispScheduler.java:137)
    at java.lang.Thread.run(Thread.java:853)

pofile文件: profiler_202410181004.html.zip

jia-wei-tang commented 1 month ago

日志里的Wisp-Root-Worker-10/12处于park状态,应该不占用CPU;Wisp-Root-Worker-4处于unpark0调用中,这个唤醒的操作应该不会占用太多资源。如果这个线程一直停止在这个函数的话,希望能够提供以下native c stack信息(可以通过gdb等方式获取) 此外,8.8.8版本是比较旧的dw8版本,建议先升级到最新版本,看看问题是否依旧存在。