提交 a4440f9b 编写于 作者: K Kohsuke Kawaguchi

[JENKINS-11097]

Added more diagnositics about how ping terminated a connection.
上级 f4aec235
...@@ -76,6 +76,9 @@ Upcoming changes</a> ...@@ -76,6 +76,9 @@ Upcoming changes</a>
<li class=bug> <li class=bug>
Label of the master should be editable if cloud is set up. Label of the master should be editable if cloud is set up.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-11100">issue 11100</a>) (<a href="https://issues.jenkins-ci.org/browse/JENKINS-11100">issue 11100</a>)
<li class=rfe>
Improved the error diagnosis by ping-driven connection termination.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-11097">issue 11097</a>)
<li class=rfe> <li class=rfe>
YUI updated to 2.9 YUI updated to 2.9
<li class=rfe> <li class=rfe>
......
...@@ -36,6 +36,7 @@ import java.io.IOException; ...@@ -36,6 +36,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.UUID; import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
/** /**
...@@ -88,8 +89,8 @@ abstract public class FullDuplexHttpChannel { ...@@ -88,8 +89,8 @@ abstract public class FullDuplexHttpChannel {
// so that we can detect dead clients, periodically send something // so that we can detect dead clients, periodically send something
PingThread ping = new PingThread(channel) { PingThread ping = new PingThread(channel) {
@Override @Override
protected void onDead() { protected void onDead(Throwable diagnosis) {
LOGGER.info("Duplex-HTTP session " + uuid + " is terminated"); LOGGER.log(Level.INFO,"Duplex-HTTP session " + uuid + " is terminated",diagnosis);
// this will cause the channel to abort and subsequently clean up // this will cause the channel to abort and subsequently clean up
try { try {
upload.close(); upload.close();
...@@ -98,6 +99,11 @@ abstract public class FullDuplexHttpChannel { ...@@ -98,6 +99,11 @@ abstract public class FullDuplexHttpChannel {
throw new AssertionError(e); throw new AssertionError(e);
} }
} }
@Override
protected void onDead() {
onDead(null);
}
}; };
ping.start(); ping.start();
main(channel); main(channel);
......
...@@ -37,7 +37,7 @@ import java.util.concurrent.atomic.AtomicBoolean; ...@@ -37,7 +37,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import static java.util.logging.Level.SEVERE; import static java.util.logging.Level.*;
/** /**
* Establish a periodic ping to keep connections between {@link Slave slaves} * Establish a periodic ping to keep connections between {@link Slave slaves}
...@@ -102,19 +102,21 @@ public class ChannelPinger extends ComputerListener { ...@@ -102,19 +102,21 @@ public class ChannelPinger extends ComputerListener {
private static void setUpPingForChannel(final Channel channel, int interval) { private static void setUpPingForChannel(final Channel channel, int interval) {
final AtomicBoolean isInClosed = new AtomicBoolean(false); final AtomicBoolean isInClosed = new AtomicBoolean(false);
final PingThread t = new PingThread(channel, interval * 60 * 1000) { final PingThread t = new PingThread(channel, interval * 60 * 1000) {
protected void onDead() { protected void onDead(Throwable cause) {
try { try {
if (isInClosed.get()) { if (isInClosed.get()) {
LOGGER.fine("Ping failed after the channel is already partially closed"); LOGGER.log(FINE,"Ping failed after the channel is already partially closed",cause);
} } else {
else { LOGGER.log(INFO,"Ping failed. Terminating the channel.",cause);
LOGGER.info("Ping failed. Terminating the channel."); channel.close(cause);
channel.close();
} }
} catch (IOException e) { } catch (IOException e) {
LOGGER.log(SEVERE,"Failed to terminate the channel: ",e); LOGGER.log(SEVERE,"Failed to terminate the channel: ",e);
} }
} }
protected void onDead() {
onDead(null);
}
}; };
channel.addListener(new Channel.Listener() { channel.addListener(new Channel.Listener() {
......
...@@ -143,7 +143,7 @@ THE SOFTWARE. ...@@ -143,7 +143,7 @@ THE SOFTWARE.
<dependency> <dependency>
<groupId>org.jenkins-ci.main</groupId> <groupId>org.jenkins-ci.main</groupId>
<artifactId>remoting</artifactId> <artifactId>remoting</artifactId>
<version>2.7</version> <version>2.9</version>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册