Our Jenkins was failing to start when there existed a Jenkins Node corresponding to a dead EC2 instance. The stack trace said: SEVERE: Failed to initialize Jenkins hudson.util.HudsonFailedToLoad: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at hudson.WebAppMain$3.run(WebAppMain.java:237) Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:604) at java.util.ArrayList.get(ArrayList.java:382) at hudson.plugins.ec2.EC2Computer._describeInstanceOnce(EC2Computer.java:166) at hudson.plugins.ec2.EC2Computer._describeInstance(EC2Computer.java:149) at hudson.plugins.ec2.EC2Computer.describeInstance(EC2Computer.java:107) at hudson.plugins.ec2.EC2Computer.getUptime(EC2Computer.java:133) at hudson.plugins.ec2.EC2RetentionStrategy.internalCheck(EC2RetentionStrategy.java:104) at hudson.plugins.ec2.EC2RetentionStrategy.check(EC2RetentionStrategy.java:85) at hudson.plugins.ec2.EC2RetentionStrategy.check(EC2RetentionStrategy.java:43) at hudson.slaves.SlaveComputer$4.run(SlaveComputer.java:717) at hudson.model.Queue._withLock(Queue.java:1346) at hudson.model.Queue.withLock(Queue.java:1229) at hudson.slaves.SlaveComputer.setNode(SlaveComputer.java:714) at hudson.model.AbstractCIBase.updateComputer(AbstractCIBase.java:118) at hudson.model.AbstractCIBase.access$000(AbstractCIBase.java:44) at hudson.model.AbstractCIBase$2.run(AbstractCIBase.java:186) at hudson.model.Queue._withLock(Queue.java:1346) at hudson.model.Queue.withLock(Queue.java:1229) at hudson.model.AbstractCIBase.updateComputerList(AbstractCIBase.java:169) at jenkins.model.Jenkins.updateComputerList(Jenkins.java:1247) at jenkins.model.Jenkins.<init>(Jenkins.java:844) at hudson.model.Hudson.<init>(Hudson.java:83) at hudson.model.Hudson.<init>(Hudson.java:79) at hudson.WebAppMain$3.run(WebAppMain.java:225) Normally when an EC2 instance is destroyed while Jenkins is running, Jenkins will recover and will delete its corresponding Jenkins Node I've already fixed the problem in our Jenkins but this issue exists for sharing the patch |