Return-Path: Delivered-To: apmail-jakarta-httpclient-user-archive@www.apache.org Received: (qmail 85860 invoked from network); 4 Dec 2006 07:51:14 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Dec 2006 07:51:14 -0000 Received: (qmail 44871 invoked by uid 500); 4 Dec 2006 07:51:22 -0000 Delivered-To: apmail-jakarta-httpclient-user-archive@jakarta.apache.org Received: (qmail 44605 invoked by uid 500); 4 Dec 2006 07:51:21 -0000 Mailing-List: contact httpclient-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: "HttpClient User Discussion" Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-user@jakarta.apache.org Received: (qmail 44594 invoked by uid 99); 4 Dec 2006 07:51:21 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Dec 2006 23:51:21 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [82.130.70.14] (HELO XSMTP0.ethz.ch) (82.130.70.14) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Dec 2006 23:51:09 -0800 Received: from EX5.d.ethz.ch ([192.168.36.13]) by XSMTP0.ethz.ch with Microsoft SMTPSVC(6.0.3790.2499); Mon, 4 Dec 2006 08:50:46 +0100 x-mimeole: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: SocketTimeoutException: Read timed out Date: Mon, 4 Dec 2006 08:50:45 +0100 Message-ID: <2F2FA11BC93EB2498BAC4718363A9A55039C4F15@EX5.d.ethz.ch> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: SocketTimeoutException: Read timed out Thread-Index: AccXeOe/hMA6Sw1PRkqTVh+W66WlaA== From: "Wittmann Armin \(BI\)" To: "HttpClient User Discussion" X-OriginalArrivalTime: 04 Dec 2006 07:50:46.0324 (UTC) FILETIME=[E83DFF40:01C71778] X-Virus-Checked: Checked by ClamAV on apache.org Hi I am using commons-httpclient in a 24x7 environment that does send simple http-POST-requests with about 7 NameValuePairs. Unfortunately I get sometimes the following error java.net.SocketTimeoutException: Read timed out (see stack trace below) Worse is that this error cannot be reproduced in development stage. It does occur mostly after a longer time of inactivity or under high test load (=3Dsome 5 requests per second). The average load in production is very low (e.g. 1 request per 10 seconds). Fortunately the server recovers from this phase of malfunction after some seconds and goes on working well. Does anybody have the same effects or is it possible that I am not programming API-conform. Here is the extract of my code inside the class CommonsHttpClient: (variables with prefix '_' are field variables in this class initialized in its=20 constructor [that reads out some properties from file]) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< public String sendHttpRequest(int pGetOrPost, NameValuePair pKeyValuePairs) throws LBSystemException { HttpConnectionManager connectionManager =3D new SimpleHttpConnectionManager(); connectionManager.setParams(_connectionManagerParams); HttpClient client =3D new HttpClient(_clientParams, connectionManager); client.setHostConfiguration(_hostConfiguration); HttpMethod method =3D null; if (pGetOrPost =3D=3D 0) { method =3D new PostMethod(); ((PostMethod) method).setRequestBody(pairs); } else if (pGetOrPost =3D=3D 1) { method =3D new GetMethod(); method.setQueryString(pairs); } method.setPath(_contextPath); method.setParams(_methodParams); int statusCode =3D -1; boolean failed =3D false; try { statusCode =3D client.executeMethod(method); } catch (Exception e) { failed =3D true; throw new MyException(p + "perform http.request failed.", e); } finally { try { if (failed) { method.abort(); =09 try { method.releaseConnection(); } catch (Exception e) { _log.warning(p + "releasing connection after evaluating http.request failed (failed=3D" + failed + "):", e); } } } catch (Exception e) { _log.warning(p + "aborting http.POST after failure raised an exception:", e); } client.setHttpConnectionManager(null); client =3D null; } } <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Notice: I do release the connection only in case of an exception! We checked with TCPDUMP on the receiving server. It does not not receive anything in such a error case. This observation is not very precise since we tried to estimate when it will occur (mostly in the morning with the first usage). And now the stacktrace: Caused by: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(Unknown Source) at com.sun.net.ssl.internal.ssl.InputRecord.readFully(Unknown Source) at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readDataRecord(Unknown Source) at com.sun.net.ssl.internal.ssl.AppInputStream.read(Unknown Source) at java.io.BufferedInputStream.fill(Unknown Source) at java.io.BufferedInputStream.read(Unknown Source) at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77) at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105) at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.jav a:1115) at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBa se.java:1832) at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase .java:1590) at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java :995) at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMe thodDirector.java:397) at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMetho dDirector.java:170) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3 96) at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3 24) at ch.ethz.id.bi.fw.common.util.http.CommonsHttpClient.sendHttpRequest(Comm onsHttpClient.java:148) ... 20 more --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpclient-user-help@jakarta.apache.org