Giter VIP home page Giter VIP logo

Comments (3)

oldratlee avatar oldratlee commented on June 2, 2024

@Seifon 你说的是脚本 show-busy-java-threads 吗?

中午更新了代码,你用最新的版本试一下~


给一下 运行的出错的信息

$ bash -x show-busy-java-threads

from useful-scripts.

Seifon avatar Seifon commented on June 2, 2024

@Seifon 你说的是脚本 show-busy-java-threads 吗?

中午更新了代码,你用最新的版本试一下~

给一下 运行的出错的信息

$ bash -x show-busy-java-threads

没有报错,只是运行后,没有将阻塞的线程打印出来,用Jstack就能打印出阻塞线程

from useful-scripts.

oldratlee avatar oldratlee commented on June 2, 2024

没有报错,只是运行后,没有将阻塞的线程打印出来,用Jstack就能打印出阻塞线程

show-busy-java-threads用排查CPU问题,缺省打印 最消耗CPU的5个线程;可以通过-c 0选项设置显示所有的线程。
# 详见 用户文档/命令Help

如果不是这个原因,则是bug,需要修复解决。 😀 @Seifon

给一下 运行的出错的信息

$ bash -x show-busy-java-threads

如果还有问题,继续反馈 😀 @Seifon


我自己用新版本的show-busy-java-threads
试了一下Java 15,是OK的: @Seifon

$ uname -a
Linux 33e449b39f66 4.19.121-linuxkit #1 SMP Thu Jan 21 15:36:34 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ bash --version
GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.5 LTS"

$ java -version
openjdk version "15.0.2" 2021-01-19
OpenJDK Runtime Environment Zulu15.29+15-CA (build 15.0.2+7)
OpenJDK 64-Bit Server VM Zulu15.29+15-CA (build 15.0.2+7, mixed mode, sharing)

$ show-busy-java-threads -c 0
[1] Busy(66.0%) thread(31118/0x798e) stack of java process(31100) under user(jerry):
"Thread-0" #12 daemon prio=5 os_prio=0 cpu=97642.70ms elapsed=174.23s tid=0x00007f20dc100240 nid=0x798e waiting for monitor entry  [0x00007f2093bf9000]
   java.lang.Thread.State: BLOCKED (on object monitor)    // **阻塞的线程**,打印出来了
        at sun.security.provider.NativePRNG$RandomIO.implNextBytes([email protected]/NativePRNG.java:544)
        - waiting to lock <0x00000000e0e00000> (a java.lang.Object)
        at sun.security.provider.NativePRNG.engineNextBytes([email protected]/NativePRNG.java:220)
        at java.security.SecureRandom.nextBytes([email protected]/SecureRandom.java:751)
        at java.util.UUID.randomUUID([email protected]/UUID.java:151)
        at Run.lambda$main$1(Run.java:19)
        at Run$$Lambda$2/0x0000000800ba8468.call(Unknown Source)
        at java.util.concurrent.FutureTask.run([email protected]/FutureTask.java:264)
        at java.util.concurrent.ThreadPoolExecutor.runWorker([email protected]/ThreadPoolExecutor.java:1130)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run([email protected]/ThreadPoolExecutor.java:630)
        at java.lang.Thread.run([email protected]/Thread.java:832)

[2] Busy(62.0%) thread(31101/0x797d) stack of java process(31100) under user(jerry):
"main" #1 prio=5 os_prio=0 cpu=98888.05ms elapsed=174.35s tid=0x00007f20dc029620 nid=0x797d runnable  [0x00007f20e4e6a000]
   java.lang.Thread.State: RUNNABLE
        at java.io.FileInputStream.readBytes([email protected]/Native Method)
        at java.io.FileInputStream.read([email protected]/FileInputStream.java:271)
        at java.io.FilterInputStream.read([email protected]/FilterInputStream.java:132)
        at sun.security.provider.NativePRNG$RandomIO.readFully([email protected]/NativePRNG.java:424)
        at sun.security.provider.NativePRNG$RandomIO.ensureBufferValid([email protected]/NativePRNG.java:526)
        at sun.security.provider.NativePRNG$RandomIO.implNextBytes([email protected]/NativePRNG.java:545)
        - locked <0x00000000e0e00000> (a java.lang.Object)
        at sun.security.provider.NativePRNG.engineNextBytes([email protected]/NativePRNG.java:220)
        at java.security.SecureRandom.nextBytes([email protected]/SecureRandom.java:751)
        at java.util.UUID.randomUUID([email protected]/UUID.java:151)
        at Run.lambda$main$1(Run.java:19)
        at Run$$Lambda$2/0x0000000800ba8468.call(Unknown Source)
        at java.util.concurrent.FutureTask.run([email protected]/FutureTask.java:264)
        at java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy.rejectedExecution([email protected]/ThreadPoolExecutor.java:2029)
        at java.util.concurrent.ThreadPoolExecutor.reject([email protected]/ThreadPoolExecutor.java:827)
        at java.util.concurrent.ThreadPoolExecutor.execute([email protected]/ThreadPoolExecutor.java:1357)
        at java.util.concurrent.AbstractExecutorService.submit([email protected]/AbstractExecutorService.java:140)
        at Run.main(Run.java:17)

......

[4] Busy(0.0%) thread(31100/0x797c) stack of java process(31100) under user(jerry):

[5] Busy(0.0%) thread(31102/0x797e) stack of java process(31100) under user(jerry):
"GC Thread#0" os_prio=0 cpu=154.84ms elapsed=174.35s tid=0x00007f20dc04f370 nid=0x797e runnable

[6] Busy(0.0%) thread(31103/0x797f) stack of java process(31100) under user(jerry):
"G1 Main Marker" os_prio=0 cpu=0.13ms elapsed=174.35s tid=0x00007f20dc054b10 nid=0x797f runnable

[7] Busy(0.0%) thread(31104/0x7980) stack of java process(31100) under user(jerry):
"G1 Conc#0" os_prio=0 cpu=0.02ms elapsed=174.35s tid=0x00007f20dc055da0 nid=0x7980 runnable

[8] Busy(0.0%) thread(31105/0x7981) stack of java process(31100) under user(jerry):
"G1 Refine#0" os_prio=0 cpu=0.15ms elapsed=174.35s tid=0x00007f20dc07da30 nid=0x7981 runnable

[9] Busy(0.0%) thread(31106/0x7982) stack of java process(31100) under user(jerry):
"G1 Young RemSet Sampling" os_prio=0 cpu=26.06ms elapsed=174.35s tid=0x00007f20dc07ec40 nid=0x7982 runnable

[10] Busy(0.0%) thread(31107/0x7983) stack of java process(31100) under user(jerry):
"VM Thread" os_prio=0 cpu=228.39ms elapsed=174.34s tid=0x00007f20dc0a7160 nid=0x7983 runnable

[11] Busy(0.0%) thread(31108/0x7984) stack of java process(31100) under user(jerry):
"Reference Handler" #2 daemon prio=10 os_prio=0 cpu=0.26ms elapsed=174.33s tid=0x00007f20dc0a9eb0 nid=0x7984 waiting on condition  [0x00007f20c0690000]
   java.lang.Thread.State: RUNNABLE
        at java.lang.ref.Reference.waitForReferencePendingList([email protected]/Native Method)
        at java.lang.ref.Reference.processPendingReferences([email protected]/Reference.java:241)
        at java.lang.ref.Reference$ReferenceHandler.run([email protected]/Reference.java:213)

[12] Busy(0.0%) thread(31109/0x7985) stack of java process(31100) under user(jerry):
"Finalizer" #3 daemon prio=8 os_prio=0 cpu=0.45ms elapsed=174.33s tid=0x00007f20dc0ab5f0 nid=0x7985 in Object.wait()  [0x00007f20c058f000]
   java.lang.Thread.State: WAITING (on object monitor)
        at java.lang.Object.wait([email protected]/Native Method)
        - waiting on <0x00000000e0e00738> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove([email protected]/ReferenceQueue.java:155)
        - locked <0x00000000e0e00738> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove([email protected]/ReferenceQueue.java:176)
        at java.lang.ref.Finalizer$FinalizerThread.run([email protected]/Finalizer.java:170)

[13] Busy(0.0%) thread(31110/0x7986) stack of java process(31100) under user(jerry):
"Signal Dispatcher" #4 daemon prio=9 os_prio=0 cpu=0.34ms elapsed=174.32s tid=0x00007f20dc0b01c0 nid=0x7986 runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

[14] Busy(0.0%) thread(31111/0x7987) stack of java process(31100) under user(jerry):
"Service Thread" #5 daemon prio=9 os_prio=0 cpu=24.91ms elapsed=174.32s tid=0x00007f20dc0b18d0 nid=0x7987 runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

[15] Busy(0.0%) thread(31112/0x7988) stack of java process(31100) under user(jerry):
"C2 CompilerThread0" #6 daemon prio=9 os_prio=0 cpu=305.69ms elapsed=174.32s tid=0x00007f20dc0b34f0 nid=0x7988 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task

[16] Busy(0.0%) thread(31113/0x7989) stack of java process(31100) under user(jerry):
"C1 CompilerThread0" #8 daemon prio=9 os_prio=0 cpu=79.09ms elapsed=174.32s tid=0x00007f20dc0b4d20 nid=0x7989 waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE
   No compile task

[17] Busy(0.0%) thread(31114/0x798a) stack of java process(31100) under user(jerry):
"Sweeper thread" #9 daemon prio=9 os_prio=0 cpu=0.24ms elapsed=174.31s tid=0x00007f20dc0b6420 nid=0x798a runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

[18] Busy(0.0%) thread(31115/0x798b) stack of java process(31100) under user(jerry):
"Notification Thread" #10 daemon prio=9 os_prio=0 cpu=0.16ms elapsed=174.28s tid=0x00007f20dc0ec380 nid=0x798b runnable  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

[19] Busy(0.0%) thread(31116/0x798c) stack of java process(31100) under user(jerry):
"VM Periodic Task Thread" os_prio=0 cpu=213.11ms elapsed=174.27s tid=0x00007f20dc0edf40 nid=0x798c waiting on condition

[20] Busy(0.0%) thread(31117/0x798d) stack of java process(31100) under user(jerry):
"Common-Cleaner" #11 daemon prio=8 os_prio=0 cpu=0.58ms elapsed=174.27s tid=0x00007f20dc0ef830 nid=0x798d in Object.wait()  [0x00007f2093cfa000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
        at java.lang.Object.wait([email protected]/Native Method)
        - waiting on <0x00000000e0e013a0> (a java.lang.ref.ReferenceQueue$Lock)
        at java.lang.ref.ReferenceQueue.remove([email protected]/ReferenceQueue.java:155)
        - locked <0x00000000e0e013a0> (a java.lang.ref.ReferenceQueue$Lock)
        at jdk.internal.ref.CleanerImpl.run([email protected]/CleanerImpl.java:148)
        at java.lang.Thread.run([email protected]/Thread.java:832)
        at jdk.internal.misc.InnocuousThread.run([email protected]/InnocuousThread.java:134)

[21] Busy(0.0%) thread(31120/0x7990) stack of java process(31100) under user(jerry):
"GC Thread#1" os_prio=0 cpu=155.13ms elapsed=173.41s tid=0x00007f20a4000f30 nid=0x7990 runnable

[22] Busy(0.0%) thread(31179/0x79cb) stack of java process(31100) under user(jerry):
"Attach Listener" #14 daemon prio=9 os_prio=0 cpu=42.03ms elapsed=168.31s tid=0x00007f20a0000e20 nid=0x79cb waiting on condition  [0x0000000000000000]
   java.lang.Thread.State: RUNNABLE

from useful-scripts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.