Return-Path: Delivered-To: apmail-jakarta-httpclient-user-archive@www.apache.org Received: (qmail 95308 invoked from network); 3 Dec 2006 23:39:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Dec 2006 23:39:09 -0000 Received: (qmail 34392 invoked by uid 500); 3 Dec 2006 23:39:17 -0000 Delivered-To: apmail-jakarta-httpclient-user-archive@jakarta.apache.org Received: (qmail 34291 invoked by uid 500); 3 Dec 2006 23:39:17 -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 34280 invoked by uid 99); 3 Dec 2006 23:39:17 -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 15:39:17 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of davidcotter@gmail.com designates 64.233.166.179 as permitted sender) Received: from [64.233.166.179] (HELO py-out-1112.google.com) (64.233.166.179) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 03 Dec 2006 15:39:06 -0800 Received: by py-out-1112.google.com with SMTP id f31so2148561pyh for ; Sun, 03 Dec 2006 15:38:12 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:references; b=QI/Lu/Phfy1/v3+HA58486DzyJiE1ooqm6NUjEiv2IYLvXsJDgHwBAWJrmdCRWShjqdeIQQQlz0n1J+2WIvrFhYD7T+9jypl8bAqrAn52S7x02shLjp9A/TWiVDbEaoUXqXpXWtO+Fs95yVRkFfhC4nwT4f1rt4fTg530x3F124= Received: by 10.35.129.19 with SMTP id g19mr14028098pyn.1165189092803; Sun, 03 Dec 2006 15:38:12 -0800 (PST) Received: by 10.35.134.17 with HTTP; Sun, 3 Dec 2006 15:38:12 -0800 (PST) Message-ID: <4c5a5abe0612031538w4bc17654x76e9682b316d8869@mail.gmail.com> Date: Sun, 3 Dec 2006 23:38:12 +0000 From: "David Cotter" Reply-To: davidcotter@gmail.com To: "Jaya Christina B" Subject: Re: Many sockets open in CLOSE_WAIT state Cc: "HttpClient User Discussion" In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_28863_5957600.1165189092767" References: X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_28863_5957600.1165189092767 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline I am using a HttpClient object for every user coming to the system. These are used to store state like cookies etc. Is there a reason why having many HttpClient objects in memory would keep many sockets open. Thanks, David On 12/1/06, Jaya Christina B wrote: > > > I got this problem when I was creating one HttpClient object for every > request. > The problem was resolved when I created one singleton HttpClient for all > my requests with a MultiThreadedConnnectionManager > > HTH > > Cheers, > Jaya. > > > -----Original Message----- > From: Mark Claassen [mailto:mclaassen@ocie.net] > Sent: Tuesday, November 28, 2006 10:41 PM > To: 'HttpClient User Discussion'; davidcotter@gmail.com > Subject: RE: Many sockets open in CLOSE_WAIT state > > I had this error as well, and for me it came from me using the API > incorrectly. My lesson as a newbie was: follow the examples as closely > as possible. I found the api very easy to use incorrectly. However, > when I changed my usage to follow the examples more closely, all my > problems magically disappeared. > > -----Original Message----- > From: David Cotter [mailto:davidcotter@gmail.com] > Sent: Tuesday, November 28, 2006 11:29 AM > To: httpclient-user@jakarta.apache.org > Subject: Re: Many sockets open in CLOSE_WAIT state > > On closer inspection there are even more sockets open: For example I > have 20,000 open sockets: 12000 are in ESTABLISHED and 8000 are in > CLOSE_WAIT. > > Regards, > David > > > On Mon, 2006-11-27 at 12:26 +0000, David Cotter wrote: > > > Hi there, > > > > > > I am having a problem with too many open files on my server. I am > > > using HttpClient v.3.0 and the server application is a proxy web app > > > > that retrieves the content using HttpClient and passes it back to > > > the user > > using > > > a Tomcat servlet. I am serving 1000s of different users with > > > several > > sever > > > requests per second. As time goes on the JVM memory usage steadily > > increases > > > as the number of open files/sockets in CLOSE_WAIT state on the Linux > > machine > > > increases. I can see from inspection that many of the open files are > > socket > > > connection to third party sites opened with HttpClient. > > > > > > For every method executed I use a shared > > MultiThreadedHttpConnectionManager > > > and always call method.releaseConnection(). > > > > > > I have instantiated IdleConnectionTimeoutThread and also have > > > another thread that occasionally calls: > > > multiThreadedHttpConnectionManager.closeIdleConnections > > (idleTimeoutMillis); > > > multiThreadedHttpConnectionManager.deleteClosedConnections(); > > > > > > I have overridden > > > MultiThreadedHttpConnectionManager.releaseConnection() > > > and included a connection.close() in this function but have not seen > > > > any results - always steadily increasing open files. > > > > > > I have seen reference to overriding > > > MultiThreadedHttpConnectionManager.releaseConnection () to force > > > sockets > > to > > > close on this list but nothing concrete as to what to put in the > > overrided > > > function. > > > > > > I would appreciate any help on this. > > > > > > > > Regards, > > > David > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org > > > > ============================================================================================================================ > > Tech Mahindra, formerly Mahindra-British Telecom. > > Disclaimer: > > This message and the information contained herein is proprietary and > confidential and subject to the Tech Mahindra policy statement, you may > review at > http://www.techmahindra.com/Disclaimer.html externally and > http://tim.techmahindra.com/Disclaimer.html internally within Tech > Mahindra. > > > ============================================================================================================================ > ------=_Part_28863_5957600.1165189092767--