Hi,

      Our Jenkins server seems to get locked at some point in time.
      Many Jobs are in starvation, waiting for nodes with certain labels/label combinations.
      (i.e. Waiting for next available executor on ...)

      The log shows a lot of these entries:

      Apr 15, 2015 3:44:25 PM SEVERE hudson.triggers.SafeTimerTask run
      
      Timer task hudson.model.Queue$MaintainTask@5d00189f failed
      java.lang.NullPointerException
      	at jenkins.advancedqueue.sorter.AdvancedQueueSorter$2.compare(AdvancedQueueSorter.java:99)
      	at jenkins.advancedqueue.sorter.AdvancedQueueSorter$2.compare(AdvancedQueueSorter.java:81)
      	at java.util.TimSort.countRunAndMakeAscending(TimSort.java:329)
      	at java.util.TimSort.sort(TimSort.java:189)
      	at java.util.TimSort.sort(TimSort.java:173)
      	at java.util.Arrays.sort(Arrays.java:659)
      	at java.util.Collections.sort(Collections.java:217)
      	at jenkins.advancedqueue.sorter.AdvancedQueueSorter.sortBuildableItems(AdvancedQueueSorter.java:81)
      	at hudson.model.Queue.maintain(Queue.java:1135)
      	at hudson.model.Queue$MaintainTask.doRun(Queue.java:2197)
      	at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
      	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      
      Feed
      

      and also some entries like

      java.lang.NullPointerException
      	at jenkins.advancedqueue.sorter.AdvancedQueueSorter.onLeft(AdvancedQueueSorter.java:157)
      	at jenkins.advancedqueue.sorter.AdvancedQueueSorterQueueListener.onLeft(AdvancedQueueSorterQueueListener.java:47)
      	at hudson.model.Queue$LeftItem.enter(Queue.java:2087)
      	at hudson.model.Queue.onStartExecuting(Queue.java:924)
      	at hudson.model.Executor.run(Executor.java:209)
      	at hudson.model.OneOffExecutor.run(OneOffExecutor.java:43)
      

      We see theses issues since we updated the Priority Sorter Plugin to version 2.11 (from version 2.9)

      Downgrading to version 2.9 seems to work fine!

          [JENKINS-27957] NullPointerException in AdvancedQueueSorter

          Tom Ghyselinck created issue -
          Tom Ghyselinck made changes -
          Component/s New: prioritysorter-plugin [ 15771 ]
          Component/s Original: core [ 15593 ]
          Assignee New: Magnus Sandberg [ emsa23 ]
          Description Original: Hi,

          Our Jenkins server seems to get locked at some point in time.
          Many Jobs are in _starvation_, waiting for nodes with certain _labels_/_label combinations_.
          (i.e. _Waiting for next available executor on ..._)

          The log shows a lot of these entries:
          {code}
          Apr 15, 2015 3:44:25 PM SEVERE hudson.triggers.SafeTimerTask run

          Timer task hudson.model.Queue$MaintainTask@5d00189f failed
          java.lang.NullPointerException
          at jenkins.advancedqueue.sorter.AdvancedQueueSorter$2.compare(AdvancedQueueSorter.java:99)
          at jenkins.advancedqueue.sorter.AdvancedQueueSorter$2.compare(AdvancedQueueSorter.java:81)
          at java.util.TimSort.countRunAndMakeAscending(TimSort.java:329)
          at java.util.TimSort.sort(TimSort.java:189)
          at java.util.TimSort.sort(TimSort.java:173)
          at java.util.Arrays.sort(Arrays.java:659)
          at java.util.Collections.sort(Collections.java:217)
          at jenkins.advancedqueue.sorter.AdvancedQueueSorter.sortBuildableItems(AdvancedQueueSorter.java:81)
          at hudson.model.Queue.maintain(Queue.java:1135)
          at hudson.model.Queue$MaintainTask.doRun(Queue.java:2197)
          at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
          at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
          at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
          at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          at java.lang.Thread.run(Thread.java:745)

          Feed
          {code}
          New: Hi,

          Our Jenkins server seems to get locked at some point in time.
          Many Jobs are in _starvation_, waiting for nodes with certain _labels_/_label combinations_.
          (i.e. _Waiting for next available executor on ..._)

          The log shows a lot of these entries:
          {code}
          Apr 15, 2015 3:44:25 PM SEVERE hudson.triggers.SafeTimerTask run

          Timer task hudson.model.Queue$MaintainTask@5d00189f failed
          java.lang.NullPointerException
          at jenkins.advancedqueue.sorter.AdvancedQueueSorter$2.compare(AdvancedQueueSorter.java:99)
          at jenkins.advancedqueue.sorter.AdvancedQueueSorter$2.compare(AdvancedQueueSorter.java:81)
          at java.util.TimSort.countRunAndMakeAscending(TimSort.java:329)
          at java.util.TimSort.sort(TimSort.java:189)
          at java.util.TimSort.sort(TimSort.java:173)
          at java.util.Arrays.sort(Arrays.java:659)
          at java.util.Collections.sort(Collections.java:217)
          at jenkins.advancedqueue.sorter.AdvancedQueueSorter.sortBuildableItems(AdvancedQueueSorter.java:81)
          at hudson.model.Queue.maintain(Queue.java:1135)
          at hudson.model.Queue$MaintainTask.doRun(Queue.java:2197)
          at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:54)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
          at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
          at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
          at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
          at java.lang.Thread.run(Thread.java:745)

          Feed
          {code}

          and also some entries like
          {code}
          java.lang.NullPointerException
          at jenkins.advancedqueue.sorter.AdvancedQueueSorter.onLeft(AdvancedQueueSorter.java:157)
          at jenkins.advancedqueue.sorter.AdvancedQueueSorterQueueListener.onLeft(AdvancedQueueSorterQueueListener.java:47)
          at hudson.model.Queue$LeftItem.enter(Queue.java:2087)
          at hudson.model.Queue.onStartExecuting(Queue.java:924)
          at hudson.model.Executor.run(Executor.java:209)
          at hudson.model.OneOffExecutor.run(OneOffExecutor.java:43)
          {code}

          We see theses issues since we updated the [Priority Sorter Plugin|https://wiki.jenkins-ci.org/display/JENKINS/Priority+Sorter+Plugin] to _version 2.11_ (from _version 2.9_)

          Downgrading to _version 2.9_ seems to work fine!
          Environment Original: Jenkins 1.596.2 LTS New: Jenkins 1.596.2 LTS
          Priority Sorter plugin 2.11

          Code changed in jenkins
          User: emsa23
          Path:
          src/main/java/jenkins/advancedqueue/sorter/AdvancedQueueSorter.java
          http://jenkins-ci.org/commit/priority-sorter-plugin/93f73c0cce8ccf5238415a8fb37cd9558d9bcf5e
          Log:
          JENKINS-27957 NullPointerException in AdvancedQueueSorter

          Some items do not have names so returning 0 seems to be the only
          option

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: emsa23 Path: src/main/java/jenkins/advancedqueue/sorter/AdvancedQueueSorter.java http://jenkins-ci.org/commit/priority-sorter-plugin/93f73c0cce8ccf5238415a8fb37cd9558d9bcf5e Log: JENKINS-27957 NullPointerException in AdvancedQueueSorter Some items do not have names so returning 0 seems to be the only option

          Fixed in 2.12

          Magnus Sandberg added a comment - Fixed in 2.12
          Magnus Sandberg made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

          Matthew Webber added a comment - - edited

          I upgraded Priority-Sorter to 3.0, and Jenkins from 1.611 to 1.612, and this problem re-appeared. Downgrading Priority-Sorter to 2.12 fixed the problem.

          Matthew Webber added a comment - - edited I upgraded Priority-Sorter to 3.0, and Jenkins from 1.611 to 1.612, and this problem re-appeared. Downgrading Priority-Sorter to 2.12 fixed the problem.
          Matthew Webber made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Closed [ 6 ] New: Reopened [ 4 ]

          Daniel Beck added a comment -

          The 3.0 issue is tracked as JENKINS-28195.

          Daniel Beck added a comment - The 3.0 issue is tracked as JENKINS-28195 .
          Daniel Beck made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Reopened [ 4 ] New: Closed [ 6 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 162556 ] New: JNJira + In-Review [ 208689 ]

            emsa23 Magnus Sandberg
            tom_ghyselinck Tom Ghyselinck
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: