java - 数百个 JBoss 5.1 系统线程永远等待

标签 java threadpool jboss5.x

大约 3 个月前,我们迁移到 JBoss 5.1.0.GA,测试几天后,我们在应用程序的日志中发现了几个内存不足错误 (OOME)。

然后I found an issue将原因描述为 JVM 版本 7 之前的错误。我们更新到版本 7u25,我们没有看到更多 OOME,但现在我看到异常庞大的线程数:大约 2k 个线程,其中 1.9k 个是守护线程。

查看我们的监控工具后发现,它们都是JBoss系统线程池生成的线程(它们都被命名为JBoss System Threads(1)-XXXX)。这是堆栈跟踪详细信息:

"JBoss System Threads(1)-1649" Id=130217 in WAITING on lock=java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject@a4d1d3
    at sun.misc.Unsafe.park(Native Method)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2043)
    at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1068)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)

我还检查了收集泄漏工具,并找到了我认为有些相关的下一个数据:

Collection Leak Info

我检查了 JBoss JIRA 但没有找到相关的内容。

有人可以告诉我发生了什么事吗?

更新:

这里是jboss-service.xml中的线程池配置

<!-- A Thread pool service -->
   <mbean code="org.jboss.util.threadpool.BasicThreadPool"
      name="jboss.system:service=ThreadPool">
      <attribute name="Name">JBoss System Threads</attribute>
      <attribute name="ThreadGroupName">System Threads</attribute>
      <!-- How long a thread will live without any tasks in MS -->
      <attribute name="KeepAliveTime">60000</attribute>
      <!-- The max number of threads in the pool -->
      <attribute name="MaximumPoolSize">3200</attribute>
      <!-- The max number of tasks before the queue is full -->
      <attribute name="MaximumQueueSize">3200</attribute>
      <!-- The behavior of the pool when a task is added and the queue is full.
      abort - a RuntimeException is thrown
      run - the calling thread executes the task
      wait - the calling thread blocks until the queue has room
      discard - the task is silently discarded without being run
      discardOldest - check to see if a task is about to complete and enque
         the new task if possible, else run the task in the calling thread
      -->
      <attribute name="BlockingMode">run</attribute>
   </mbean>

最佳答案

线程是由池创建的,因为运行服务器的 Java 版本不兼容。我们切换到早期版本,问题就消失了。

关于java - 数百个 JBoss 5.1 系统线程永远等待,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18385441/

相关文章:

email - jboss5 通过 smtp + tls 发送电子邮件

web-services - Java 网络服务不适用于 Jdk 6 和 Jboss 5.x

Java,关于缓存大量 GB 的策略有帮助吗?

Java - JSONObject 仅解析 1 个字符串?

java - Java 中的二重积分和期望值蒙特卡洛方法

java - 是否有必要在 ThreadFactory 中使用 AtomicInteger?

java - 线程模板

java - 机器人 : how to create new Directory in my package path

java - 在 Scala 的 "Future"的 ForkJoinPool 中,为什么 worker 的 ID 总是奇数?

Gradle 编译未更改但类被 aopc 修改的 java 源