perfsonar-dev - axis client timeouts
Subject: perfsonar development work
List archive
- From: "Nina Jeliazkova" <>
- To:
- Cc: Joe Metzger <>
- Subject: axis client timeouts
- Date: Thu, 06 Sep 2007 12:52:50 +0300
Hi all,
This message is to share my today investigation on using axis client timeout
(Call.setTimeout), which were triggered by Joe Metzger observations that
PerfsonarUI options for connection timeout (5 min by default) in fact result
in connections timing out in far less time.
The test has been just submitted within perfsonarUI source tree.
/**
* Test for axis1.4 timeout peculiarities. If web service is called with
timeouts (in this order)
*
* 1000000,100000,10000,1000,100,10,1, then the output is as expected:
<pre>
Timeout 1000000ms Completed in 1484ms OK
Timeout 100000ms Completed in 1235ms OK
Timeout 10000ms Completed in 1266ms OK
Timeout 1000ms Completed in 1281ms OK
Timeout 100ms Completed in 453ms ; nested exception is:
java.net.SocketTimeoutException: Read timed out
Timeout 10ms Completed in 500ms ; nested exception is:
java.net.SocketTimeoutException: Read timed out
Timeout 1ms Completed in 610ms ; nested exception is:
java.net.SocketTimeoutException: Read timed out
</pre>
However, if the web service is called with timeouts in the reverse order
1,10,100,1000,10000,100000,1000000
all connections leads to timeout!!!
<pre>
Timeout 1ms Completed in 156ms ; nested exception is:
java.net.SocketTimeoutException: connect timed out
Timeout 10ms Completed in 47ms ; nested exception is:
java.net.SocketTimeoutException: connect timed out
Timeout 100ms Completed in 16ms ; nested exception is:
java.net.SocketTimeoutException: connect timed out
Timeout 1000ms Completed in 31ms ; nested exception is:
java.net.SocketTimeoutException: connect timed out
Timeout 10000ms Completed in 16ms ; nested exception is:
java.net.SocketTimeoutException: connect timed out
Timeout 100000ms Completed in 16ms ; nested exception is:
java.net.SocketTimeoutException: connect timed out
Timeout 1000000ms Completed in 15ms ; nested exception is:
java.net.SocketTimeoutException: connect timed out
</pre>
Possible reason is hidden within package
org.apache.axis.components.net.SocketFactoryFactory.
<pre>
public static synchronized SocketFactory getFactory(String protocol,
Hashtable attributes)
{
SocketFactory theFactory = (SocketFactory)factories.get(protocol);
...
</pre>
If the factory has already been created (e.g. not null), then attributes have
no effect on the returned factory, and therefore timeout value is not updated.
The consequences are that factory retains the timeout value, set when created,
and all sockets created afterwards are created with the initial timeout value.
In the second test, all sockets are created with timeout=1ms and therefore the
socket immediately is closed (within 1ms).
In the first test, all sockets are created with timeout=1000000ms and
Call.setTimeout() , which is HTTP connection timeout,
can be applied correctly.
*
*/
public void testAxis() {
int[] timeout = new int[] {1,10,100,1000,10000,100000,1000000};
MAEndpoint e = new
MAEndpoint("GEANT2,http://stats.geant2.net/perfsonar/RRDMA-access/MeasurementArchiveService,http://schemas.perfsonar.net/2.0,,http://ggf.org/ns/nmwg/characteristic/utilization/2.0,http://ggf.org/ns/nmwg/characteristic/utilization/2.0");
EchoSmartRequest factory = new EchoSmartRequest();
EchoMARequest echo = (EchoMARequest)factory.createMARequest(e);
AbstractUserData data = new AbstractUserData();
data.setEndpoint(e);
try {
Document doc =
echo.createRequest(data,IPerfsonarRequest.MA_EchoRequest);
SOAPBodyElement requestMessage = new
SOAPBodyElement(doc.getDocumentElement());
for (int i=0; i <timeout.length; i++) {
//for (int i=timeout.length-1; i>=0;i--) {
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new URL(e.getEndpoint()));
call.setOperationName(new
QName("http://soapinterop.org/","submit"));
call.setTimeout(new Integer(timeout[i]));
long now = System.currentTimeMillis();
String status = "OK";
try {
call.invoke(new Object[] {requestMessage});
} catch (RemoteException x) {
//x.printStackTrace();
status = x.getMessage();
}
long completed = System.currentTimeMillis() - now;
System.out.println("Timeout\t"+timeout[i]+"ms\tCompleted
in\t"+completed+"ms\t"+status);
}
} catch (Exception x) {
x.printStackTrace();
fail(x.getMessage());
}
}
}
There might be other yet unknown reasons for current PerfsonarUI timeout
behaviour, but this is pretty suspicious. Has anybody else encounter this?
PerfsonarUI is using latest axis 1.4 (April 2006), I am not aware of more
recent Axis 1.x implementation.
Best regards,
Nina
- axis client timeouts, Nina Jeliazkova, 09/06/2007
Archive powered by MHonArc 2.6.16.