Please see [1]. This test case was added to illustrate how to set up all the options to make sure all the sockets get cleaned up.
-- dims [1] http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/async/AsyncService2Test.java?view=markup On 9/6/07, Jake Goulding <[EMAIL PROTECTED]> wrote: > Andrew: > > This is exactly what is happening. I get many things stuck in the TCP > TIME_WAIT state. Running my test, I see many sockets move into the > TIME_WAIT state. I am doing my testing on Windows, which imposes a limit > of about 4000 [1] ports by default. It also defaults to a 4 minute period. > > In order for a socket to get out of the TIME_WAIT state, the socket has > to be closed cleanly from both sides during the 3- or 4- way closing > handshake [3]. If the handshake is not done completely, it stays in the > TIME_WAIT state for the timeout length, in order to allow lost packets > to arrive. > > I assume that the Axis client must initiate the shutdown, as the server > could not know when the communication is complete. > > I guess this boils down to two questions: > > 1/ Why does Axis not make use of the HTTP 1.1 spec wherein it would > establish one connection and keep it open? > > 2/ Why does Axis not close the socket when it is done with it? > > Thanks for the feedback, I hope you can expand on some of my questions! > > -Jake > > [1] http://support.microsoft.com/support/kb/articles/q196/2/71.asp > [2] http://www.windowsitpro.com/Articles/ArticleID/23276/23276.html > [3] > http://en.wikipedia.org/wiki/Transmission_Control_Protocol#Connection_termination > > Andrew McGhee wrote: > > Hi Jake, > > I'm not an expert in Axis at all, but I am wondering if you are > > encountering an exhaustion of available ports for socket connections on > > your machine. > > > > This is a wild stab in the dark, but I did have similar problems in a > > Linux environment a long time ago, with socket based client / service > > architecture. > > > > Have you tried "netstat -na" on the machine in question, and checked the > > number of "TIME_WAIT" entries? > > > > > >>>> [EMAIL PROTECTED] 09/07/07 5:43 am >>> > > 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: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > ***************************************************************** > > This email, including any attachments sent with it, is > > confidential and for the sole use of the intended recipient(s). > > This confidentiality is not waived or lost, if you receive it and > > you are not the intended recipient(s), or if it is transmitted/ > > received in error. > > > > Any unauthorised use, alteration, disclosure, distribution or > > review of this email is strictly prohibited. The information > > contained in this email, including any attachment sent with > > it, may be subject to a statutory duty of confidentiality if it > > relates to health service matters. > > > > If you are not the intended recipient(s), or if you have > > received this email in error, you are asked to immediately > > notify the sender by telephone collect on Australia > > +61 1800 198 175 or by return email. You should also > > delete this email, and any copies, from your computer > > system network and destroy any hard copies produced. > > > > If not an intended recipient of this email, you must not copy, > > distribute or take any action(s) that relies on it; any form of > > disclosure, modification, distribution and/or publication of this > > email is also prohibited. > > > > Although Queensland Health takes all reasonable steps to > > ensure this email does not contain malicious software, > > Queensland Health does not accept responsibility for the > > consequences if any person's computer inadvertently suffers > > any disruption to services, loss of information, harm or is > > infected with a virus, other malicious computer programme or > > code that may occur as a consequence of receiving this > > email. > > > > Unless stated otherwise, this email represents only the views > > of the sender and not the views of the Queensland Government. > > **************************************************************** > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Davanum Srinivas :: http://davanum.wordpress.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]