From 3ec7e562fe9225efb42272a9427499a11e059f48 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Sun, 23 Feb 2014 16:57:05 -0500 Subject: [PATCH] =?UTF-8?q?Trying=20to=20diagnose=20recent=20CI=20failures?= =?UTF-8?q?=20of=20HtmlUnit=20calls.=20For=20example=20https://jenkins.ci.?= =?UTF-8?q?cloudbees.com/job/core/job/jenkins-core-validated-merge/38/test?= =?UTF-8?q?Report/lib.layout/LayoutTest/rejectedLinks/=20failed=20with:=20?= =?UTF-8?q?java.io.IOException:=20GET=20http://localhost:52099/jenkins/log?= =?UTF-8?q?in=20failed=20=09at=20java.net.SocketInputStream.socketRead0(Na?= =?UTF-8?q?tive=20Method)=20=09at=20java.net.SocketInputStream.read(Socket?= =?UTF-8?q?InputStream.java:152)=20=09at=20java.net.SocketInputStream.read?= =?UTF-8?q?(SocketInputStream.java:122)=20=09at=20java.io.BufferedInputStr?= =?UTF-8?q?eam.fill(BufferedInputStream.java:235)=20=09at=20java.io.Buffer?= =?UTF-8?q?edInputStream.read(BufferedInputStream.java:254)=20=09at=20org.?= =?UTF-8?q?apache.commons.httpclient.HttpParser.readRawLine(HttpParser.jav?= =?UTF-8?q?a:78)=20=09at=20org.apache.commons.httpclient.HttpParser.readLi?= =?UTF-8?q?ne(HttpParser.java:106)=20=09at=20org.apache.commons.httpclient?= =?UTF-8?q?.HttpConnection.readLine(HttpConnection.java:1116)=20=09at=20or?= =?UTF-8?q?g.apache.commons.httpclient.MultiThreadedHttpConnectionManager$?= =?UTF-8?q?HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManag?= =?UTF-8?q?er.java:1413)=20=09at=20org.apache.commons.httpclient.HttpMetho?= =?UTF-8?q?dBase.readStatusLine(HttpMethodBase.java:1973)=20=09at=20org.ap?= =?UTF-8?q?ache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodB?= =?UTF-8?q?ase.java:1735)=20=09at=20org.apache.commons.httpclient.HttpMeth?= =?UTF-8?q?odBase.execute(HttpMethodBase.java:1098)=20=09at=20org.apache.c?= =?UTF-8?q?ommons.httpclient.HttpMethodDirector.executeWithRetry(HttpMetho?= =?UTF-8?q?dDirector.java:398)=20=09at=20org.apache.commons.httpclient.Htt?= =?UTF-8?q?pMethodDirector.executeMethod(HttpMethodDirector.java:171)=20?= =?UTF-8?q?=09at=20org.apache.commons.httpclient.HttpClient.executeMethod(?= =?UTF-8?q?HttpClient.java:397)=20=09at=20org.apache.commons.httpclient.Ht?= =?UTF-8?q?tpClient.executeMethod(HttpClient.java:346)=20=09at=20com.gargo?= =?UTF-8?q?ylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConne?= =?UTF-8?q?ction.java:101)=20=09at=20com.gargoylesoftware.htmlunit.WebClie?= =?UTF-8?q?nt.loadWebResponseFromWebConnection(WebClient.java:1456)=20=09a?= =?UTF-8?q?t=20com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(Web?= =?UTF-8?q?Client.java:1387)=20=09at=20com.gargoylesoftware.htmlunit.WebCl?= =?UTF-8?q?ient.getPage(WebClient.java:328)=20=09at=20com.gargoylesoftware?= =?UTF-8?q?.htmlunit.WebClient.getPage(WebClient.java:389)=20=09at=20com.g?= =?UTF-8?q?argoylesoftware.htmlunit.WebClient.getPage(WebClient.java:374)?= =?UTF-8?q?=20=09at=20org.jvnet.hudson.test.JenkinsRule$WebClient.goTo(Jen?= =?UTF-8?q?kinsRule.java:1944)=20=09at=20org.jvnet.hudson.test.JenkinsRule?= =?UTF-8?q?$WebClient.goTo(JenkinsRule.java:1926)=20=09at=20lib.layout.Lay?= =?UTF-8?q?outTest.rejectedLinks(LayoutTest.java:44)=20which=20makes=20lit?= =?UTF-8?q?tle=20sense=20since=20the=20named=20IOException=20is=20actually?= =?UTF-8?q?=20thrown=20from=20HttpWebConnection.java:130.=20Perhaps=20Sure?= =?UTF-8?q?fire=20is=20not=20reporting=20the=20original=20cause=20correctl?= =?UTF-8?q?y,=20conflating=20the=20wrapper=E2=80=99s=20message=20with=20th?= =?UTF-8?q?e=20original=20stack=20trace.=20As=20a=20temporary=20measure,?= =?UTF-8?q?=20printing=20the=20original=20stack=20trace=20to=20stderr=20if?= =?UTF-8?q?=20there=20is=20any.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/jvnet/hudson/test/HudsonTestCase.java | 10 +++++++++- .../main/java/org/jvnet/hudson/test/JenkinsRule.java | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java index 1cc68e21bb..a5a0d6bd57 100644 --- a/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java +++ b/test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java @@ -1815,7 +1815,15 @@ public abstract class HudsonTestCase extends TestCase implements RootAction { } public Page goTo(String relative, String expectedContentType) throws IOException, SAXException { - Page p = super.getPage(getContextPath() + relative); + Page p; + try { + p = super.getPage(getContextPath() + relative); + } catch (IOException x) { + if (x.getCause() != null) { + x.getCause().printStackTrace(); + } + throw x; + } assertEquals(expectedContentType,p.getWebResponse().getContentType()); return p; } diff --git a/test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java b/test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java index d74a44c9e9..fa01b7709a 100644 --- a/test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java +++ b/test/src/main/java/org/jvnet/hudson/test/JenkinsRule.java @@ -1941,7 +1941,15 @@ public class JenkinsRule implements TestRule, MethodRule, RootAction { */ public Page goTo(String relative, @CheckForNull String expectedContentType) throws IOException, SAXException { assert !relative.startsWith("/"); - Page p = super.getPage(getContextPath() + relative); + Page p; + try { + p = super.getPage(getContextPath() + relative); + } catch (IOException x) { + if (x.getCause() != null) { + x.getCause().printStackTrace(); + } + throw x; + } if (expectedContentType != null) { assertThat(p.getWebResponse().getContentType(), is(expectedContentType)); }