【问题标题】:Hundreds of JBoss 5.1 System Threads WAITING forever数百个 JBoss 5.1 系统线程永远等待
【发布时间】:2014-03-30 11:56:43
【问题描述】:

大约 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)

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

我检查了 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>

【问题讨论】:

  • 收藏没有问题。只是你有大量的线程。你的线程在做什么?为什么它们没有终止?
  • 我相信你只是有一个错误配置的线程池。一旦应用程序遇到高负载,它就会启动所有这些线程并且永远不会终止它们。您必须限制核心池大小和超时。我的应用程序有完全相同的问题,我相信管理员能够通过配置解决它。
  • @happymeal for the stacktrace 我认为他们只是在等待工作
  • @MarkoTopolnik 我用线程池配置更新了问题。
  • 尽管它不能解释为什么所有线程都挂起,但 3200 个线程显然是矫枉过正 :-) 你至少可以解决这个问题。

标签: java threadpool jboss5.x


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-24
    • 2012-02-24
    相关资源
    最近更新 更多