mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-06 08:36:01 +00:00
[FIXED JENKINS-46659] Avoid Jetty timeouts by sending a ping-like packet every 10s while a CLI command is running.
This commit is contained in:
1 parent
68f5585999
commit
dc06c3f03b
3 files changed
+16
-10
No files matched your search
@@ -704,6 +704,22 @@ public class CLI implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
new Thread("ping") { // JENKINS-46659
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(10_000);
|
||||
while (!connection.complete) {
|
||||
LOGGER.fine("sending ping");
|
||||
connection.sendEncoding(Charset.defaultCharset().name()); // no-op at this point
|
||||
Thread.sleep(10_000);
|
||||
}
|
||||
} catch (IOException | InterruptedException x) {
|
||||
LOGGER.log(Level.WARNING, null, x);
|
||||
}
|
||||
}
|
||||
|
||||
}.start();
|
||||
synchronized (connection) {
|
||||
while (!connection.complete) {
|
||||
connection.wait();
|
||||
|
||||
@@ -34,7 +34,6 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.channels.ClosedChannelException;
|
||||
import java.nio.channels.ReadPendingException;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
@@ -112,13 +111,6 @@ class PlainCLIProtocol {
|
||||
} catch (EOFException x) {
|
||||
handleClose();
|
||||
break; // TODO verify that we hit EOF immediately, not partway into framelen
|
||||
} catch (IOException x) {
|
||||
if (x.getCause() instanceof TimeoutException) { // TODO on Tomcat this seems to be SocketTimeoutException
|
||||
LOGGER.log(Level.FINE, "ignoring idle timeout, perhaps from Jetty", x);
|
||||
continue;
|
||||
} else {
|
||||
throw x;
|
||||
}
|
||||
}
|
||||
if (framelen < 0) {
|
||||
throw new IOException("corrupt stream: negative frame length");
|
||||
|
||||
Reference in new issue
Block a user