Skip to content

[JENKINS-52159] Jenkins Queue DoS when QueueItemSorter extension throws runtime Exception #22848

Description

@jenkins-infra-bot

We just upgraded to 2.129. Our jenkins is configured to start nodes as needed; release nodes as upon idle; and run a job on master which turns nodes off if they aren't in use.

We had the accelerated-build-now-plugin (version 1.0.1) plugin enabled.

When our normal or pipeline jobs start, they try to pick any node other than master. Jenkins starts the node, it appears in the list of available nodes, but Jenkins doesn't manage to start a build on the node:

SEVERE: Timer task hudson.model.Queue$MaintainTask@​2041414e failed
java.lang.ClassCastException: org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask cannot be cast to hudson.model.AbstractProject
at org.terracotta.jenkins.plugins.acceleratedbuildnow.AcceleratedBuildNowComparator.compare(AcceleratedBuildNowComparator.java:21)
at org.terracotta.jenkins.plugins.acceleratedbuildnow.AcceleratedBuildNowComparator.compare(AcceleratedBuildNowComparator.java:11)
at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
at java.util.TimSort.sort(TimSort.java:220)
at java.util.Arrays.sort(Arrays.java:1512)
at java.util.ArrayList.sort(ArrayList.java:1462)
at java.util.Collections.sort(Collections.java:175)
at org.terracotta.jenkins.plugins.acceleratedbuildnow.AcceleratedBuildNowSorter.sortBuildableItems(AcceleratedBuildNowSorter.java:30)
at hudson.model.Queue.maintain(Queue.java:1571)
at hudson.model.Queue$MaintainTask.doRun(Queue.java:2862)
at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:72)
at jenkins.security.ImpersonatingScheduledExecutorService$1.run(ImpersonatingScheduledExecutorService.java:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748) 

Instead, the jobs sit waiting, and eventually the computers being idle are released by jenkins and then reaped by the job on master.

Disabling this plugin results in our system working as it used to work.


Originally reported by jsoref, imported from: Jenkins Queue DoS when QueueItemSorter extension throws runtime Exception
  • assignee: anthonydahanne
  • status: Resolved
  • priority: Blocker
  • component(s): core
  • label(s): 2.121.3-fixed
  • resolution: Fixed
  • resolved: 2018-07-03T18:01:45+00:00
  • votes: 0
  • watchers: 3
  • imported: 2025-11-24
Raw content of original issue

We just upgraded to 2.129. Our jenkins is configured to start nodes as needed; release nodes as upon idle; and run a job on master which turns nodes off if they aren't in use.

We had the accelerated-build-now-plugin (version 1.0.1) plugin enabled.

When our normal or pipeline jobs start, they try to pick any node other than master. Jenkins starts the node, it appears in the list of available nodes, but Jenkins doesn't manage to start a build on the node:

SEVERE: Timer task hudson.model.Queue$MaintainTask@2041414e failed
java.lang.ClassCastException: org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask cannot be cast to hudson.model.AbstractProject
        at org.terracotta.jenkins.plugins.acceleratedbuildnow.AcceleratedBuildNowComparator.compare(AcceleratedBuildNowComparator.java:21)
        at org.terracotta.jenkins.plugins.acceleratedbuildnow.AcceleratedBuildNowComparator.compare(AcceleratedBuildNowComparator.java:11)
        at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
        at java.util.TimSort.sort(TimSort.java:220)
        at java.util.Arrays.sort(Arrays.java:1512)
        at java.util.ArrayList.sort(ArrayList.java:1462)
        at java.util.Collections.sort(Collections.java:175)
        at org.terracotta.jenkins.plugins.acceleratedbuildnow.AcceleratedBuildNowSorter.sortBuildableItems(AcceleratedBuildNowSorter.java:30)
        at hudson.model.Queue.maintain(Queue.java:1571)
        at hudson.model.Queue$MaintainTask.doRun(Queue.java:2862)
        at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:72)
        at jenkins.security.ImpersonatingScheduledExecutorService$1.run(ImpersonatingScheduledExecutorService.java:58)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748) 

Instead, the jobs sit waiting, and eventually the computers being idle are released by jenkins and then reaped by the job on master.

Disabling this plugin results in our system working as it used to work.

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions