IndexOutOfBoundsException from MappingWorksheet$ReadOnlyList.get in executor threads

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      When clicking on the Dead link in the executors widget:

      java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
      	at java.util.ArrayList.rangeCheck(Unknown Source)
      	at java.util.ArrayList.get(Unknown Source)
      	at hudson.model.queue.MappingWorksheet$ReadOnlyList.get(MappingWorksheet.java:102)
      	at hudson.model.queue.MappingWorksheet$ExecutorChunk.execute(MappingWorksheet.java:150)
      	at hudson.model.queue.MappingWorksheet$ExecutorChunk.access$000(MappingWorksheet.java:110)
      	at hudson.model.queue.MappingWorksheet$Mapping.execute(MappingWorksheet.java:298)
      	at hudson.model.Queue.maintain(Queue.java:1045)
      	at hudson.model.Queue.pop(Queue.java:863)
      	at hudson.model.Executor.grabJob(Executor.java:285)
      	at hudson.model.Executor.run(Executor.java:206)
      

      Looking at the code

      assert capacity() >= wc.size();
      int e = 0;
      for (SubTask s : wc) {
          while (!get(e).isAvailable()) // IOOBE
              e++;
          get(e++).set(wuc.createWorkUnit(s));
      }
      

      it seems wrong: when isAvailable is false, you are almost sure to run out of slots, since there is no range check on e.

            Assignee:
            Unassigned
            Reporter:
            Jesse Glick
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: