未验证 提交 2fbd132b 编写于 作者: J Jesse Glick

[JENKINS-57993] Avoid printing stack traces for some common agent conditions.

上级 c489b07f
......@@ -43,13 +43,13 @@ import hudson.slaves.OfflineCause;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.net.SocketAddress;
import java.util.Arrays;
import jenkins.AgentProtocol;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
......@@ -286,7 +286,11 @@ public final class TcpSlaveAgentListener extends Thread {
// try to clean up the socket
}
} catch (IOException e) {
LOGGER.log(Level.WARNING,"Connection #"+id+" failed",e);
if (e instanceof EOFException) {
LOGGER.log(Level.INFO, "Connection #{0} failed: {1}", new Object[] {id, e});
} else {
LOGGER.log(Level.WARNING, "Connection #" + id + " failed", e);
}
try {
s.close();
} catch (IOException ex) {
......
......@@ -24,6 +24,7 @@ import jenkins.util.SystemProperties;
import org.jenkinsci.remoting.engine.JnlpConnectionState;
import java.io.IOException;
import java.nio.channels.ClosedChannelException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
......@@ -181,7 +182,9 @@ public class DefaultJnlpSlaveReceiver extends JnlpAgentReceiver {
public void channelClosed(@NonNull JnlpConnectionState event) {
final String nodeName = event.getProperty(JnlpConnectionState.CLIENT_NAME_KEY);
IOException cause = event.getCloseCause();
if (cause != null) {
if (cause instanceof ClosedChannelException) {
LOGGER.log(Level.INFO, "{0} for {1} terminated: {2}", new Object[] {Thread.currentThread().getName(), nodeName, cause});
} else if (cause != null) {
LOGGER.log(Level.WARNING, Thread.currentThread().getName() + " for " + nodeName + " terminated",
cause);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册