简体   繁体   English

线程转储包含处于RUNNABLE状态且没有堆栈的线程

[英]Thread dump containing threads in RUNNABLE state with no stack

Doing a thread dump on a highly loaded application with CPU, I see a lot of threads in this state: 在具有CPU的高负载应用程序上执行线程转储,我看到很多线程处于这种状态:

"ajp-executor-threads - XXXXXX" prio=10 tid=0x00002b04b8b33801 nid=0x5327 runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE “ ajp-executor-threads-XXXXXX” prio = 10 tid = 0x00002b04b8b33801 nid = 0x5327 runnable [0x0000000000000000] java.lang.Thread.State:RUNNABLE

What is really strange to me is that there is no stacktrace at all and that total number of ajp-thread is higher than max-threads (below) configured 我真正奇怪的是,根本没有堆栈跟踪,并且ajp线程的总数大于配置的max-threads (如下)

It is happening with an application running on: 它是在以下应用程序上运行的:

  • JBoss 7 JBoss 7
  • Java 7u75 Java 7u75
  • Redhat 5.11 红帽5.11
  • Running on VMWare Enterprise / vSphere 5.5 在VMWare Enterprise / vSphere 5.5上运行

Configuration of executor is: 执行程序的配置为:

 <subsystem xmlns="urn:jboss:domain:threads:1.1">
        <bounded-queue-thread-pool name="ajp-executor">
            <core-threads count="32"/>
            <queue-length count="1"/>
            <max-threads count="300"/>
            <keepalive-time time="5" unit="seconds"/>
        </bounded-queue-thread-pool>
    </subsystem>

Note that load is very high as on this host: 请注意,此主机上的负载非常高:

  • CPU reaches 70% CPU达到70%

  • Load is at 4 (== number of vCPU) 负载为4(== vCPU数量)

Note these threads are not idle threads as an idle thread has this stack trace: 请注意,这些线程不是空闲线程,因为空闲线程具有以下堆栈跟踪:

 "Reference Handler" daemon prio=5 tid=0x00007f92cb00e800 nid=0x3703 in Object.wait() [0x000000012057e000]
     java.lang.Thread.State: WAITING (on object monitor)
     at java.lang.Object.wait(Native Method)
     - waiting on <0x00000007aaa84470> (a java.lang.ref.Reference$Lock)
     at java.lang.Object.wait(Object.java:503)
     at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)
     - locked <0x00000007aaa84470> (a java.lang.ref.Reference$Lock)

After further analysis I found that issue is due to remote debugging being enabled through: 经过进一步分析,我发现问题是由于通过以下方式启用了远程调试:

-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=XXXXXXX -Xrunjdwp:transport = dt_socket,server = y,suspend = n,address = XXXXXXX

This explains these strange empty stack traces in thread dump. 这解释了线程转储中这些奇怪的空堆栈跟踪。

Those are your idle threads in the AJP executor connection pool. 这些是AJP执行程序连接池中的空闲线程。 You have set the core threads to 32 meaning that the pool will always maintain 32 threads in the connection pool, although they may be idle. 您已将核心线程设置为32,这意味着该池将始终在连接池中维护32个线程,尽管它们可能处于空闲状态。 With your configuration you could see up to 300 threads but any thread over 32 will only wait 5 seconds before dying and being removed from the connection pool. 使用您的配置,您最多可以看到300个线程,但是32个以上的任何线程在死亡并从连接池中删除之前仅等待5秒钟。

As for you CPU load, I doubt its in any way related to these idle connection pool threads. 至于您的CPU负载,我怀疑它是否与这些空闲的连接池线程有关。

See John Skeet's answer here for some more info on connection pools and keep alive: https://stackoverflow.com/a/10379348/91866 有关连接池的更多信息,请参见John Skeet的答案,并保持存活: https : //stackoverflow.com/a/10379348/91866

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM