Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-60389

Queue.maintain blocked by WorkflowJob.getBuildByNumber via getAffinityKey



    • 2.36


      Was running a CloudBees Core managed master. Restarted the master; I think there was a build running which had a node block with an unsatisfied label. At any rate, restart was very slow, and in the course of inspecting thread dumps during startup I noticed something which looked inappropriate:

      "jenkins.util.Timer [#3]" ... waiting for monitor entry ...
         java.lang.Thread.State: BLOCKED (on object monitor)
      	at jenkins.model.lazy.AbstractLazyLoadRunMap.getByNumber(AbstractLazyLoadRunMap.java:371)
      	- waiting to lock <...> (a hudson.model.RunMap)
      	at jenkins.model.lazy.LazyBuildMixIn.getBuildByNumber(LazyBuildMixIn.java:228)
      	at org.jenkinsci.plugins.workflow.job.WorkflowJob.getBuildByNumber(WorkflowJob.java:232)
      	at org.jenkinsci.plugins.workflow.job.WorkflowJob.getBuildByNumber(WorkflowJob.java:103)
      	at hudson.model.Run.fromExternalizableId(Run.java:2446)
      	at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask.runForDisplay(ExecutorStepExecution.java:503)
      	at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask.getOwnerTask(ExecutorStepExecution.java:436)
      	at org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution$PlaceholderTask.getAffinityKey(ExecutorStepExecution.java:600)
      	at hudson.model.LoadBalancer$1.assignGreedily(LoadBalancer.java:119)
      	at hudson.model.LoadBalancer$1.map(LoadBalancer.java:107)
      	at hudson.model.LoadBalancer$2.map(LoadBalancer.java:167)
      	at hudson.model.Queue.maintain(Queue.java:1640)
      	at hudson.model.Queue$MaintainTask.doRun(Queue.java:2898)
      	at ...

      Here getAffinityKey is waiting to load a build record (Run object) merely to determine the name of the owning job, which is silly since this information is available simply from the runId.


        Issue Links


            jglick Jesse Glick created issue -
            jglick Jesse Glick made changes -
            Field Original Value New Value
            Status Open [ 1 ] In Progress [ 3 ]
            jglick Jesse Glick made changes -
            Link This issue is caused by JENKINS-36547 [ JENKINS-36547 ]
            jglick Jesse Glick made changes -
            Remote Link This issue links to "workflow-durable-task-step #126 (Web Link)" [ 24109 ]
            jglick Jesse Glick made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            jglick Jesse Glick made changes -
            Released As 2.36
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Fixed but Unreleased [ 10203 ]
            jglick Jesse Glick made changes -
            Status Fixed but Unreleased [ 10203 ] Resolved [ 5 ]
            jglick Jesse Glick made changes -
            Link This issue causes JENKINS-63486 [ JENKINS-63486 ]


              jglick Jesse Glick
              jglick Jesse Glick
              0 Vote for this issue
              1 Start watching this issue