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 2.204.1.1 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.

          [JENKINS-60389] Queue.maintain blocked by WorkflowJob.getBuildByNumber via getAffinityKey

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

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: