Return-Path: Delivered-To: apmail-jakarta-httpclient-user-archive@www.apache.org Received: (qmail 20371 invoked from network); 22 Mar 2006 15:49:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 22 Mar 2006 15:49:44 -0000 Received: (qmail 56495 invoked by uid 500); 22 Mar 2006 15:49:21 -0000 Delivered-To: apmail-jakarta-httpclient-user-archive@jakarta.apache.org Received: (qmail 56442 invoked by uid 500); 22 Mar 2006 15:49: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 56398 invoked by uid 99); 22 Mar 2006 15:49:21 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Mar 2006 07:49:21 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [195.186.19.64] (HELO mail18.bluewin.ch) (195.186.19.64) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Mar 2006 07:49:19 -0800 Received: from [192.168.0.4] (85.0.2.189) by mail18.bluewin.ch (Bluewin 7.2.071) id 441EA29C0008FCB9 for httpclient-user@jakarta.apache.org; Wed, 22 Mar 2006 15:48:58 +0000 Subject: Re: java.net.BindException when loadtesting.. From: Oleg Kalnichevski To: HttpClient User Discussion In-Reply-To: <44213729.4000808@eviware.com> References: <687B7858C99ED711B87B00B0D0D1C922045172DA@lambic.guideworks.tv> <44213729.4000808@eviware.com> Content-Type: text/plain Date: Wed, 22 Mar 2006 16:48:56 +0100 Message-Id: <1143042536.8404.9.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Wed, 2006-03-22 at 12:38 +0100, Ole Matzura wrote: > Hi all! > > I have a "strange" problem.. I'm running loadtests on a local IIS using > a MultiThreadedConnectionManager created as follows: > > MultiThreadedHttpConnectionManager connectionManager = new > MultiThreadedHttpConnectionManager(); > connectionManager.getParams().setDefaultMaxConnectionsPerHost( 500 ); > connectionManager.getParams().setMaxTotalConnections( 2000 ); > httpClient = new HttpClient(connectionManager); > > (i've tried lower values with the same results) > > My loadtest runs 10 parallell threads which create new PostMethods > containing a "Connection: close" header for each request. Well. Since you force connection close per each request, at some point your process may create more sockets than the OS can allocate enough local ports for. The fact that HttpClient called #close() on the java.net.Socket instance may not necessarily mean that the local port used by the socket can immediately be made available for a new socket Oleg > After each > request I call postMethod.releaseConnection().. (in a finally block) > > After about 3600 requests i get an exception when calling > httpClient.executeMethod( postMethod ); > > java.net.BindException: Address already in use: connect > at java.net.PlainSocketImpl.socketConnect(Native Method) > at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333) > at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195) > at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182) > at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) > at java.net.Socket.connect(Socket.java:507) > at java.net.Socket.connect(Socket.java:457) > at java.net.Socket.(Socket.java:365) > at java.net.Socket.(Socket.java:238) > at > org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:79) > at > org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:121) > at > org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:706) > at > org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1321) > at > org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:386) > at > org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170) > at > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396) > at > org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324) > > running netstat from the command line shows a list of thousands of > active connections.. shouldn't these have been closed? IIS returns the > Connection: close header in the response. Why am I running out of > connections/sockets/ports/whatever? What am I doing wrong? Can I "force" > the closing of the requests some other way? > > thanks for any help! > > regards, > > Ole > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpclient-user-help@jakarta.apache.org