Return-Path: Delivered-To: apmail-jakarta-httpclient-user-archive@www.apache.org Received: (qmail 15280 invoked from network); 4 Apr 2007 18:47:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Apr 2007 18:47:31 -0000 Received: (qmail 66380 invoked by uid 500); 4 Apr 2007 18:47:36 -0000 Delivered-To: apmail-jakarta-httpclient-user-archive@jakarta.apache.org Received: (qmail 66365 invoked by uid 500); 4 Apr 2007 18:47:36 -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 66354 invoked by uid 99); 4 Apr 2007 18:47:36 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Apr 2007 11:47:36 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [71.246.141.26] (HELO swmail.stone-ware.com) (71.246.141.26) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Apr 2007 11:47:27 -0700 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2826 Subject: Question about MultiThreadedHttpConnectionManager Date: Wed, 4 Apr 2007 14:46:42 -0400 Importance: normal Priority: normal Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Question about MultiThreadedHttpConnectionManager Thread-Index: Acd26ZZCZUiznacmRz6vuTq4FUThWw== From: "Tony Thompson" To: "HttpClient User Discussion" X-Virus-Checked: Checked by ClamAV on apache.org First a little background on my application. I have a proxy application that accepts requests from an HTTP user agent and then uses the Apache HttpClient to facilitate passing that request to a particular host. I had been using the 2.0.2 version of the HttpClient and everything was working perfectly. Recently I upgraded my code to the 3.0.1 version of the HttpClient and I have noticed a weird little issue. I am using the MultiThreadedHttpConnectionManager and I think the issue I am having is in there but I am not sure. So, a little info on the issue that I am seeing. With the 3.0.1 client, my application works fine for a bit. Seems like it works OK until a certain amount of data is moved through it or something. I have been unable to track down why it works and then stops working. I have done some packet traces of the client in a working state and when it is broken. The issue seems to be that in the middle of an HTTP 1.1 conversation, the client is opening a second socket to the host and is splitting the requests across the two sockets. Even though all of the data is getting to the server, the server is confused by the fact that it is now coming in from 2 different connections. I suppose it could be an issue with the way I am using the client but, I am confused why it worked perfectly with the 2.0.2 client and works for a bit with the 3.0.1 client before it breaks. Here are the basic steps I go through in my code for one HTTP request: 1. agent submits request 2. proxy gets the request and creates an HttpMethod 3. proxy determines what host to submit the request and gets a HostConfiguration for that host 4. proxy does HttpClient.executeMethod( hostConfig, method ) 5. response is processed and proxy calls method.releaseConnection() ..... n. connection is closed between agent and proxy So, steps 1 - 5 are executed several times: AGENT PROXY HOST ------------------------------------------------------ req ---------------> req on port 1700 -----------> resp <-------------- resp <---------------------- resp req ---------------> req on port 1700 -----------> resp <-------------- resp <---------------------- resp req ---------------> req on port 1700 -----------> resp <-------------- resp <---------------------- resp req ---------------> req on port 1700 -----------> resp <-------------- resp <---------------------- resp close When the conversation breaks: AGENT PROXY HOST ------------------------------------------------------ req ---------------> req on port 1700 -----------> resp <-------------- resp <---------------------- resp req ---------------> req on port 1701 -----------> resp <-------------- resp <---------------------- resp req ---------------> req on port 1701 -----------> resp <-------------- resp <---------------------- resp req ---------------> req on port 1700 -----------> resp <-------------- resp <---------------------- resp close The question I have is about the MultiThreadedHttpConnectionManager. Did it used to keep track of the connection it would make subsequent requsts on in a ThreadLocal (even though I was calling releaseConnection() between requests) possibly and now it now longer does that? That is speculation on my part but like I said, I can't explain why it worked in 2.0.2 and why now it thinks it needs to open another connection at some point during that conversation. If anyone was able to make sense of my long email and has any input, I would appreciate it. Tony This message (and any associated files) is intended only for the use of the individual or entity to which it is addressed and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not the intended recipient you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Messages sent to and from Stoneware, Inc. may be monitored. --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpclient-user-help@jakarta.apache.org