Skip to content
Permalink
Browse files
[FIXED JENKINS-42043] Catch and log RuntimeException in setNode
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 6128459dd39a7a1722894cd0a5a69a6c8c767abb
Showing with 8 additions and 2 deletions.
  1. +8 −2 core/src/main/java/hudson/model/AbstractCIBase.java
@@ -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;

@@ -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()) {
@@ -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) {

0 comments on commit 6128459

Please sign in to comment.