提交 9150d5b5 编写于 作者: J Jesse Glick

Suppress an idle timeout from Jetty which would otherwise interfere with interactive commands.

上级 6c63890e
......@@ -34,6 +34,7 @@ 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;
......@@ -106,6 +107,13 @@ 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) {
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");
......
......@@ -257,6 +257,7 @@ public class CLIActionTest {
@Issue("JENKINS-41745")
@Test
public void interleavedStdio() throws Exception {
logging.record(PlainCLIProtocol.class, Level.FINE);
File jar = tmp.newFile("jenkins-cli.jar");
FileUtils.copyURLToFile(j.jenkins.getJnlpJars("jenkins-cli.jar").getURL(), jar);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
......@@ -273,6 +274,7 @@ public class CLIActionTest {
while (!baos.toString().contains("121")) { // ditto not "===> 121"
Thread.sleep(100);
}
Thread.sleep(31_000); // aggravate org.eclipse.jetty.io.IdleTimeout (cf. AbstractConnector._idleTimeout)
pw.println("11 * 11 * 11");
while (!baos.toString().contains("1331")) {
Thread.sleep(100);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册