web client running out of ports! (timeout exception)

2005-11-29 Thread Magyar, Bence
Hello,  I noticed some strange behavior the other day while load testing my simple web service. First, my environment: I am running Apache Tomcat 5.5.12 with Axis 1.3 on an XP box. I've used Java2WSDL and WSDL2Java to generate the necessary bindings. I used the generated .wsdd file to deploy my service with an "Application" deployment scope and my Java client can call methods on the service the ease. So far, so good.  By looking at the Axis SOAP monitor, all my messages seem to be getting through fine. The trouble starts when I begin rapidly calling web service methods within a loop. The first 3000 calls or so go through fine. Then I get an Axis Fault: timeout exception. See the attached is the stack trace.  Why is this happening? I used the -netstat utility on the machine hosting the web service and noticed that -ea
 ch-
 method call is coming in on a different port! Every time I call a method, my java client opens a new port! On XP, the default port range goes from 1024-5000. Worse yet, each port is in the TIME_WAIT state, meaning that it can't be re-used untill some specified timeout period. After waiting for 10-20 seconds, Windows frees up all the ports and I can begin happily calling methods again.   I'm not sure why this is happening! I thought the entire point of HTTP/1.1 was to persist connections. If I make two calls to the same web service within X seconds of each other, shouldn't TCP/IP use the already established connection? Especially a connection that is not in use and in the TIME_WAIT state?I am fairly sure that I need to set the well-known TCP/IP parameter SO_REUSEADDR to true. I know I can configure Tomcat with the server.xml file, but I could 
 not find
 anything related to this phenomena. Instead, I see parameters relating to the keepalivetime, etc...My method calls will not be data intensive, butwill be making many (thousands) method invocations at once. Ideally I'd like to have one or two connections to the webservice and re-use them. Does anyone have any idea how I could configure Tomcat/Axis to perform in this manner?  P.S.. In looking at some Apache source, I noticed that Apache sets the SO_REUSE_ADDR variable, but only in NON-win32 environments! Is this feature not available in the Windows world? Thanks for any leads!!!  BM.   
		 Yahoo! Music Unlimited - Access over 1 million songs. Try it free.AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: java.net.ConnectException: Connection timed out: connect
 faultActor: 
 faultNode: 
 faultDetail: 
{http://xml.apache.org/axis/}stackTrace:java.net.ConnectException: 
Connection timed out: 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:364)
at java.net.Socket.connect(Socket.java:507)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at 
org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:153)
at 
org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:120)
at 
org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)
at 
org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)
at 
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at 
webService.ws.SensorcontrolSoapBindingStub.getCapabilities(SensorcontrolSoapBindingStub.java:305)
at somepackage.Tester$3.mouseDown(Tester.java:275)
at 
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:133)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3080)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2713)
at 

RE: web client running out of ports! (timeout exception)

2005-11-29 Thread Magyar, Bence
Hi,
   
  You're right, it's probably something screwy with my client.  Not sure what 
it could be though.
   
  In looking at my Tomcat terminal, i see:
   
  INFO: Starting Coyote HTTP/1.1 on http-8080
   
  Shouldn't I be getting persistent, reusable connections as the default with 
HTTP/1.1?
   
  B.M
   
   
  

Caldarale, Charles R [EMAIL PROTECTED] wrote:   From: Magyar, Bence 
[mailto:[EMAIL PROTECTED] 
 Subject: web client running out of ports! (timeout exception)
 
 Every time I call a method, my java client opens a new port!

If I'm understanding the problem correctly, I don't see how changing
anything in the Tomcat configuation will help this anti-social client
behavior. Sounds like you need to fix your client to reuse connections
rather than creating a new one for each request.

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
 Yahoo! Music Unlimited - Access over 1 million songs. Try it free.

RE: web client running out of ports! (timeout exception)

2005-11-29 Thread Caldarale, Charles R
 From: Magyar, Bence [mailto:[EMAIL PROTECTED] 
 Subject: RE: web client running out of ports! (timeout exception)

   Shouldn't I be getting persistent, reusable connections as 
 the default with HTTP/1.1?

I'm sure you are - but it's the client's responsibility to reuse them;
all the server has to do is expect more traffic on the connection, which
appears to be what it's doing.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]