Ole, Are you only declaring your HttpClient object as static? It is the MultiThreadedConnectionManager object that maintains the connection pool. That needs to be declared as static in addition to HttpClient.
--Steve -----Original Message----- From: Ole Matzura [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 22, 2006 8:41 AM To: HttpClient User Discussion Subject: Re: java.net.BindException when loadtesting.. Thanks Steve, "unfortunately", thats exactly what I'm doing.. just creating one httpclient instance statically at startup.. any other ideas? regards, /Ole Steve Terrell skrev: > You only need once instance of MultiThreadedConnectionManager and > HttpClient for your application. It looks like you are creating numerous > copies of these objects. Each time you do that, you are creating a > separate connection pool. I suspect that's why you are 'leaking' > connections. > > Try declaring MultiThreadedConnectionManager and HttpClient objects as > static. > > --Steve > > -----Original Message----- > From: Ole Matzura [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 22, 2006 6:38 AM > To: HttpClient User Discussion > Subject: java.net.BindException when loadtesting.. > > 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. 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.<init>(Socket.java:365) > at java.net.Socket.<init>(Socket.java:238) > at > org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.crea > teSocket(DefaultProtocolSocketFactory.java:79) > at > org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.crea > teSocket(DefaultProtocolSocketFactory.java:121) > at > org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:70 > 6) > at > org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpCon > nectionAdapter.open(MultiThreadedHttpConnectionManager.java:1321) > at > org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMe > thodDirector.java:386) > 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) > > 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
