You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Jake Goulding <go...@vivisimo.com> on 2007/08/30 22:22:09 UTC

[axis2] BindException from Axis client

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:195)
        at
org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77)
        at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:327)
        at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:206)
        at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396)
        at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374)
        at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.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.createSocket(ReflectionSocketFactory.java:139)
        at
org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:124)
        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:346)
        at
org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:520)
        at
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:191)
        ... 9 more


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: [axis2] BindException from Axis client

Posted by Jake Goulding <go...@vivisimo.com>.
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:195)
>         at
> org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:77)
>         at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:327)
>         at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:206)
>         at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396)
>         at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:374)
>         at
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.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.createSocket(ReflectionSocketFactory.java:139)
>         at
> org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:124)
>         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:346)
>         at
> org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:520)
>         at
> org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:191)
>         ... 9 more
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org