Return-Path: Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: (qmail 4560 invoked from network); 25 Oct 2009 13:35:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Oct 2009 13:35:03 -0000 Received: (qmail 50369 invoked by uid 500); 25 Oct 2009 13:35:02 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 50309 invoked by uid 500); 25 Oct 2009 13:35:02 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 50299 invoked by uid 99); 25 Oct 2009 13:35:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Oct 2009 13:35:02 +0000 X-ASF-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL,BAYES_00,HTML_MESSAGE,MIME_QP_LONG_LINE,UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [212.150.204.129] (HELO nexperience.com) (212.150.204.129) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Oct 2009 13:34:59 +0000 Received: from Internal Mail-Server by PUMA (envelope-from mosheb@perfectomobile.com) with SMTP; 25 Oct 2009 15:24:58 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01CA5577.9CD06172" Subject: SO_TIMEOUT on a request level Date: Sun, 25 Oct 2009 15:32:34 +0200 Message-ID: <75E4C42D37E6A74E9FB57C2E9F1300D60184B6BF@tiger.nexperience.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: SO_TIMEOUT on a request level Thread-Index: AcpVd5wvLnLROkgPS1CdBYWBitiKgQ== From: "Moshe Ben-Shoham" To: ------_=_NextPart_001_01CA5577.9CD06172 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, =20 The scenario is as follows: I'm doing two consecutive requests to the same host, using a multi-threaded (or thread safe) connection pool manager. The first invocation has a timeout of 10s and the second has a timeout of 30s.=20 =20 In version 3.1 of HttpClient all works well, but in 4.0 I get a timeout exception in the second request, after ~10 seconds, which means the first timeout is used. =20 Looking at the code, I see that in version 3.1, the HttpMethodDirector.executeWithRetry() method invokes a method named applyConnectionParams() that took care of setting the timeout taken from the request on the socket.=20 =20 But in version 4.0, the only place I see the timeout is set on the socket is when DefaultRequestDirector.execute(HttpHost, HttpRequest, HttpContext) opens a connection using the managedConn.open() method. Since the connection is reused between the requests, the second request uses a socket with a timeout of the first request. As a (bad) workaround, I put on the HttpClient instance a ConnectionReuseStrategy that always says no to reusing the connection, so a new connection is created for the second request, with the required timeout. =20 Am I missing something? =20 Thanks, Moshe. The information contained in this message is proprietary to the sender, protected from disclosure, and may be privileged. The information is intended to be conveyed only to the designated recipient(s) of the message. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, use, distribution or copying of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. ************************************************************************************ This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses. ************************************************************************************ ------_=_NextPart_001_01CA5577.9CD06172--