Skip to content

Commit

Permalink
[FIXED JENKINS-28058] Don't send a reference to Computer.class over r…
Browse files Browse the repository at this point in the history
…emoting channels

- Logging added to help diagnose was actually causing Jenkins.class to be initialized on the remoting side

(cherry picked from commit df83132)
  • Loading branch information
stephenc authored and olivergondza committed Jul 30, 2015
1 parent 132b915 commit b591a24
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions core/src/main/java/hudson/model/Computer.java
Expand Up @@ -1159,19 +1159,22 @@ public String getHostName() throws IOException, InterruptedException {
try {
InetAddress ia = InetAddress.getByName(address);
if(!(ia instanceof Inet4Address)) {
LOGGER.fine(address+" is not an IPv4 address");
LOGGER.log(Level.FINE, "{0} is not an IPv4 address", address);
continue;
}
if(!ComputerPinger.checkIsReachable(ia, 3)) {
LOGGER.fine(address+" didn't respond to ping");
LOGGER.log(Level.FINE, "{0} didn't respond to ping", address);
continue;
}
cachedHostName = ia.getCanonicalHostName();
hostNameCached = true;
return cachedHostName;
} catch (IOException e) {
// if a given name fails to parse on this host, we get this error
LOGGER.log(Level.FINE, "Failed to parse "+address,e);
LogRecord lr = new LogRecord(Level.FINE, "Failed to parse {0}");
lr.setThrown(e);
lr.setParameters(new Object[]{address});
LOGGER.log(lr);
}
}

Expand All @@ -1195,27 +1198,29 @@ public String getHostName() throws IOException, InterruptedException {
}

private static class ListPossibleNames extends MasterToSlaveCallable<List<String>,IOException> {
private static final Logger LOGGER = Logger.getLogger(ListPossibleNames.class.getName());

public List<String> call() throws IOException {
List<String> names = new ArrayList<String>();

Enumeration<NetworkInterface> nis = NetworkInterface.getNetworkInterfaces();
while (nis.hasMoreElements()) {
NetworkInterface ni = nis.nextElement();
LOGGER.fine("Listing up IP addresses for "+ni.getDisplayName());
LOGGER.log(Level.FINE, "Listing up IP addresses for {0}", ni.getDisplayName());
Enumeration<InetAddress> e = ni.getInetAddresses();
while (e.hasMoreElements()) {
InetAddress ia = e.nextElement();
if(ia.isLoopbackAddress()) {
LOGGER.fine(ia+" is a loopback address");
LOGGER.log(Level.FINE, "{0} is a loopback address", ia);
continue;
}

if(!(ia instanceof Inet4Address)) {
LOGGER.fine(ia+" is not an IPv4 address");
LOGGER.log(Level.FINE, "{0} is not an IPv4 address", ia);
continue;
}

LOGGER.fine(ia+" is a viable candidate");
LOGGER.log(Level.FINE, "{0} is a viable candidate", ia);
names.add(ia.getHostAddress());
}
}
Expand Down

0 comments on commit b591a24

Please sign in to comment.