Metrics plugin leaks 'QueueSubTaskMetrics' threads when monitoring the Queue


  • The Jenkins controller thread dump show lot of threads like the following:
"QueueSubTaskMetrics [#XXX]" #XXXXX daemon prio=5 os_prio=0 tid=0x00001a1234567890 nid=0xa46e waiting on condition [0x00001a0987654321]
   java.lang.Thread.State: TIMED_WAITING (parking)
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x0000000q2w3e4r5> (a java.util.concurrent.SynchronousQueue$TransferStack)
	at java.util.concurrent.locks.LockSupport.parkNanos(
	at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(
	at java.util.concurrent.SynchronousQueue$TransferStack.transfer(
	at java.util.concurrent.SynchronousQueue.poll(
	at java.util.concurrent.ThreadPoolExecutor.getTask(
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$


Related Issues


The Metrics plugin monitors the Queue asynchronously. It is leaking QueueSubTaskMetrics threads when a SubTask from the build queue fails badly - in such a way that the task is never updated. In such cases the QueueSubTaskMetrics thread wait forever for a event that will never occur.

The controller needs to be restarted to clean those threads.

The root cause of this issue is actually a bug in Jenkins core that is not updating the SubTask consistently in case of premature failure captured by JENKINS-59793.


Upgrade CloudBees Core to version or later.

Have more questions?


Please sign in to leave a comment.