Thanks for the suggestion. However, I'm not sure how that would be different from my example below...
In my example, I create only 1 Stub, then use it 5000 times. That is the case that causes the exception to be thrown. This should be equivalent to creating a pool of size N and each thread doing work 5000/N times. In that case, I would actually hit the exception even sooner (chronologically), as theoretically some of those threads would be working in parallel. What seems to happen is that, after a HTTP session is opened, Axis / HTTP Commons cannot possibly know that I am done with the socket. HTTP 1.1 even mandates that the socket do Keep-Alive to reduce load. Somehow, I need to tell Axis / HTTP Commons that I am done with a particular Stub / Socket and to close it. Again, thanks for the help, and I hope you or someone else has more insight. -Jake Walker, Jeff wrote: > Just a dumb idea, > but in such a high performance environment, wouldn't a thread pool work > better?, where each thread has a Stub and when it has done its work for > that open request it is returned to the pool. > If you initialize the pool to about 700 threads, then at least you have > some control over the situation (varying the pool size to accommodate > your available memory etc.) and you should never see the BindException > because any Stub blocked waiting on a timeout (or general io wait) will > not be returned to the pool yet. > > The idea needs further work. It won't increase your throughput, but it > might stop the exceptions and still be worth looking into? > -jeff > > > > -----Original Message----- > From: Jake Goulding [mailto:[EMAIL PROTECTED] > Sent: Thursday, September 06, 2007 3:43 PM > To: axis-user@ws.apache.org > Subject: Re: [axis2] BindException from Axis client > > This is just a bump. I'm sure that anyone else out there using Axis in > an high-performance environment can easily run into this problem. Should > I log a JIRA issue? Comment on one of the existing JIRAs? > > Thanks! > > -Jake > > Jake Goulding wrote: >> Hey all: >> >> I wrote in with this problem quite a while back, and a few people > tried >> to help. The basic problem is that a stub, when making many requests >> quickly, will eventually fail with a BindException: >> >> There are a few references to this issue in JIRA: >> >> https://issues.apache.org/jira/browse/AXIS2-2593 (Fixed) >> https://issues.apache.org/jira/browse/AXIS2-2441 (Fixed) >> https://issues.apache.org/jira/browse/AXIS2-2883 (Open) >> >> This is a fairly common case in our usage of webservices, and >> particularly hits hard on Windows, which seems to default to only >> allowing ~4000 open sockets at once. >> >> This is very easy to reproduce, all you need is a webservice that >> returns quickly (a hello world service works well) and a loop in the >> client that calls the service over and over. >> >> I have tried the following code with Axis 1.1.1 (our current > production >> version) as well as Axis 1.3. This code accesses a service on another >> computer, so no sharing of resources should come into play. Perhaps I > am >> using Axis incorrectly, and would be glad to be corrected if that is > the >> case. I added a call to Stub.cleanup() inside the loop, but it did not >> seem to help. >> >> Thanks for all your help in advance! >> >> -Jake >> >> >> My sample code: >> >> Service1Stub s = new Service1Stub(); >> for (int i = 0; i < 5000; i++) { >> Service1Stub.HelloWorldResponse r = null; >> Service1Stub.HelloWorld h = new Service1Stub.HelloWorld(); >> r = s.HelloWorld(h); >> } >> >> My exception: >> >> Exception in thread "main" org.apache.axis2.AxisFault: Address already >> in use: connect >> at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417) >> at >> > org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:1 > 95) >> at >> org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77) >> at >> > org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageW > ithCommons(CommonsHTTPTransportSender.java:327) >> at >> > org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(Common > sHTTPTransportSender.java:206) >> at > org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396) >> at >> > org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOper > ation.java:374) >> at >> > org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInA > xisOperation.java:211) >> at >> > org.apache.axis2.client.OperationClient.execute(OperationClient.java:163 > ) >> at test.Service1Stub.HelloWorld(Service1Stub.java:145) >> at Loop.main(Loop.java:12) >> Caused by: java.net.BindException: Address already in use: connect >> at java.net.PlainSocketImpl.socketConnect(Native Method) >> at java.net.PlainSocketImpl.doConnect(Unknown Source) >> at java.net.PlainSocketImpl.connectToAddress(Unknown Source) >> at java.net.PlainSocketImpl.connect(Unknown Source) >> at java.net.SocksSocketImpl.connect(Unknown Source) >> at java.net.Socket.connect(Unknown Source) >> at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) >> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown > Source) >> at java.lang.reflect.Method.invoke(Unknown Source) >> at >> > org.apache.commons.httpclient.protocol.ReflectionSocketFactory.createSoc > ket(ReflectionSocketFactory.java:139) >> at >> > org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.crea > teSocket(DefaultProtocolSocketFactory.java:124) >> 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 > 46) >> at >> > org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(Abstrac > tHTTPSender.java:520) >> at >> > org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:1 > 91) >> ... 9 more >> >> >> --------------------------------------------------------------------- >> 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]