Skip to content

Commit

Permalink
[FIXED JENKINS-42043] Catch and log RuntimeException in setNode
Browse files Browse the repository at this point in the history
Also make sure we don't mark the Computer as used so that we kill any
executors that may be related to it somehow.

(cherry picked from commit 23b0085)
  • Loading branch information
abayer authored and olivergondza committed May 2, 2017
1 parent c553801 commit 6128459
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions core/src/main/java/hudson/model/AbstractCIBase.java
Expand Up @@ -36,6 +36,7 @@

import java.util.*;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.CheckForNull;

Expand Down Expand Up @@ -115,7 +116,12 @@ private void updateComputer(Node n, Map<String,Computer> byNameMap, Set<Computer
Computer c;
c = byNameMap.get(n.getNodeName());
if (c!=null) {
c.setNode(n); // reuse
try {
c.setNode(n); // reuse
used.add(c);
} catch (RuntimeException e) {
LOGGER.log(Level.WARNING, "Error updating node " + n.getNodeName() + ", continuing", e);
}
} else {
// we always need Computer for the master as a fallback in case there's no other Computer.
if(n.getNumExecutors()>0 || n==Jenkins.getInstance()) {
Expand All @@ -131,8 +137,8 @@ private void updateComputer(Node n, Map<String,Computer> byNameMap, Set<Computer
}
}
}
used.add(c);
}
used.add(c);
}

/*package*/ void removeComputer(final Computer computer) {
Expand Down

0 comments on commit 6128459

Please sign in to comment.