You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@ws.apache.org by Jason Wyatt <jw...@itree.com.au> on 2003/01/22 08:30:08 UTC

looong connection timeout if server down

Hi,

I used XML-RPC on a project recently and it was pretty good, except I had a
problem with a very long timeout if the server went down. It seems the
timeout was quick when we were developing under Windows (~30seconds) but
when we deployed to Solaris the timeout was around 3-4 minutes.This was a
bit of a problem because our client's remote devices which run the XML-RPC
server may or may not be available at any given time.

We considered changing the kernel socket connect timeout settings on the
XML-RPC client machine, but this seemed like a risky option as it could
adversely affect other internet services. I had a look at hacking the
XML_RPC client but gave up once I got down to http and couldn't see an
obvious connect timeout setting.

Is there an easy programmatic way of changing the connection timeout that I
am missing here? I would seriously like to use XML-PRC again on a new
project, but the socket timeout issue is a vote against it.

Any help with this would be kindly appreciated.

Thanks in advance,
Jason.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Itree Software         www.itree.com.au
 Ph (02)42263454        Fax (02)42263193
        -> Meeting your requirements.
        -> Delivering on promises.
        -> Pride in our work.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Re: looong connection timeout if server down

Posted by Ryan Hoegg <rh...@isisnetworks.net>.
Hi Jason,

In version 1.2, your answer is regrettably no.  However you may have a 
fairly short job of it with the latest CVS version.

This is definitely a transport layer issue, and pertains directly to 
some of our recent development directions.  Version 2.0 will include the 
concept of an XmlRpcTransport to be used by the XmlRpcClient.  This 
transport can be implemented in different ways.

Currently in CVS there are two implementations of the XmlRpcTransport 
interface: LiteXmlRpcTransport and DefaultXmlRpcTransport. 
 DefaultXmlRpcTransport uses java.net.URLConnection, and I do not know 
anything about timeouts with URLConnection.  However, 
LiteXmlRpcTransport uses a raw java.net.Socket, which has a 
setSoTimeout() method.  It would be trivial to modify this class to have 
a configurable timeout.

Finally, I have a working (but ugly) draft of an XmlRpcTransport using 
the Jakarta Commons HttpClient.  This will support connection timeouts 
as well as many other more advanced HTTP features.  Unfortunately, I am 
not ready for anyone to see this code as it is incomplete and needs to 
be refactored (I needed it for a project).  Hopefully I will find time 
in the next couple of weeks to clean it up and add it to CVS.

--
Ryan Hoegg
ISIS Networks
http://www.isisnetworks.net



Jason Wyatt wrote:

> Hi,
>  
> I used XML-RPC on a project recently and it was pretty good, except I 
> had a problem with a very long timeout if the server went down. It 
> seems the timeout was quick when we were developing under Windows 
> (~30seconds) but when we deployed to Solaris the timeout was around 
> 3-4 minutes.This was a bit of a problem because our client's remote 
> devices which run the XML-RPC server may or may not be available at 
> any given time.
>  
> We considered changing the kernel socket connect timeout settings on 
> the XML-RPC client machine, but this seemed like a risky option as it 
> could adversely affect other internet services. I had a look at 
> hacking the XML_RPC client but gave up once I got down to http and 
> couldn't see an obvious connect timeout setting.
>  
> Is there an easy programmatic way of changing the connection timeout 
> that I am missing here? I would seriously like to use XML-PRC again on 
> a new project, but the socket timeout issue is a vote against it.
>  
> Any help with this would be kindly appreciated.
>  
> Thanks in advance,
> Jason.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  Itree Software         www.itree.com.au
>  Ph (02)42263454        Fax (02)42263193
>         -> Meeting your requirements.
>         -> Delivering on promises.
>         -> Pride in our work.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>


Re: looong connection timeout if server down

Posted by Ryan Hoegg <rh...@isisnetworks.net>.
Hi Jason,

In version 1.2, your answer is regrettably no.  However you may have a 
fairly short job of it with the latest CVS version.

This is definitely a transport layer issue, and pertains directly to 
some of our recent development directions.  Version 2.0 will include the 
concept of an XmlRpcTransport to be used by the XmlRpcClient.  This 
transport can be implemented in different ways.

Currently in CVS there are two implementations of the XmlRpcTransport 
interface: LiteXmlRpcTransport and DefaultXmlRpcTransport. 
 DefaultXmlRpcTransport uses java.net.URLConnection, and I do not know 
anything about timeouts with URLConnection.  However, 
LiteXmlRpcTransport uses a raw java.net.Socket, which has a 
setSoTimeout() method.  It would be trivial to modify this class to have 
a configurable timeout.

Finally, I have a working (but ugly) draft of an XmlRpcTransport using 
the Jakarta Commons HttpClient.  This will support connection timeouts 
as well as many other more advanced HTTP features.  Unfortunately, I am 
not ready for anyone to see this code as it is incomplete and needs to 
be refactored (I needed it for a project).  Hopefully I will find time 
in the next couple of weeks to clean it up and add it to CVS.

--
Ryan Hoegg
ISIS Networks
http://www.isisnetworks.net



Jason Wyatt wrote:

> Hi,
>  
> I used XML-RPC on a project recently and it was pretty good, except I 
> had a problem with a very long timeout if the server went down. It 
> seems the timeout was quick when we were developing under Windows 
> (~30seconds) but when we deployed to Solaris the timeout was around 
> 3-4 minutes.This was a bit of a problem because our client's remote 
> devices which run the XML-RPC server may or may not be available at 
> any given time.
>  
> We considered changing the kernel socket connect timeout settings on 
> the XML-RPC client machine, but this seemed like a risky option as it 
> could adversely affect other internet services. I had a look at 
> hacking the XML_RPC client but gave up once I got down to http and 
> couldn't see an obvious connect timeout setting.
>  
> Is there an easy programmatic way of changing the connection timeout 
> that I am missing here? I would seriously like to use XML-PRC again on 
> a new project, but the socket timeout issue is a vote against it.
>  
> Any help with this would be kindly appreciated.
>  
> Thanks in advance,
> Jason.
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  Itree Software         www.itree.com.au
>  Ph (02)42263454        Fax (02)42263193
>         -> Meeting your requirements.
>         -> Delivering on promises.
>         -> Pride in our work.
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>


RE: looong connection timeout if server down

Posted by Mauro Canal <mc...@canalsystems.net>.
Hello Jason

the timeout problem comes from the insufficient implementation
within the URLConnection class used in DefaultXmlRpcTransport.

there are two solutions for your problem:
1. execute the request in a thread for the XmlRpcClient and
   check the timeout.
2. create an own XmlRpcTransport implementation using the HttpClient from
   http://jakarta.apache.org/commons/httpclient/index.html.
   This client implements the timeout functionality.
   Take a look on the DefaultXmlRpcTransport class how to implement the
   deatils.

Mauro Canal
mcanal@canalsystems.net

-----Original Message-----
From: Jason Wyatt [mailto:jwyatt@itree.com.au]
Sent: Wednesday, January 22, 2003 8:30 AM
To: rpc-user@xml.apache.org
Subject: looong connection timeout if server down


Hi,

I used XML-RPC on a project recently and it was pretty good, except I had a
problem with a very long timeout if the server went down. It seems the
timeout was quick when we were developing under Windows (~30seconds) but
when we deployed to Solaris the timeout was around 3-4 minutes.This was a
bit of a problem because our client's remote devices which run the XML-RPC
server may or may not be available at any given time.

We considered changing the kernel socket connect timeout settings on the
XML-RPC client machine, but this seemed like a risky option as it could
adversely affect other internet services. I had a look at hacking the
XML_RPC client but gave up once I got down to http and couldn't see an
obvious connect timeout setting.

Is there an easy programmatic way of changing the connection timeout that I
am missing here? I would seriously like to use XML-PRC again on a new
project, but the socket timeout issue is a vote against it.

Any help with this would be kindly appreciated.

Thanks in advance,
Jason.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Itree Software         www.itree.com.au
 Ph (02)42263454        Fax (02)42263193
        -> Meeting your requirements.
        -> Delivering on promises.
        -> Pride in our work.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


RE: looong connection timeout if server down

Posted by Mauro Canal <mc...@canalsystems.net>.
Hello Jason

the timeout problem comes from the insufficient implementation
within the URLConnection class used in DefaultXmlRpcTransport.

there are two solutions for your problem:
1. execute the request in a thread for the XmlRpcClient and
   check the timeout.
2. create an own XmlRpcTransport implementation using the HttpClient from
   http://jakarta.apache.org/commons/httpclient/index.html.
   This client implements the timeout functionality.
   Take a look on the DefaultXmlRpcTransport class how to implement the
   deatils.

Mauro Canal
mcanal@canalsystems.net

-----Original Message-----
From: Jason Wyatt [mailto:jwyatt@itree.com.au]
Sent: Wednesday, January 22, 2003 8:30 AM
To: rpc-user@xml.apache.org
Subject: looong connection timeout if server down


Hi,

I used XML-RPC on a project recently and it was pretty good, except I had a
problem with a very long timeout if the server went down. It seems the
timeout was quick when we were developing under Windows (~30seconds) but
when we deployed to Solaris the timeout was around 3-4 minutes.This was a
bit of a problem because our client's remote devices which run the XML-RPC
server may or may not be available at any given time.

We considered changing the kernel socket connect timeout settings on the
XML-RPC client machine, but this seemed like a risky option as it could
adversely affect other internet services. I had a look at hacking the
XML_RPC client but gave up once I got down to http and couldn't see an
obvious connect timeout setting.

Is there an easy programmatic way of changing the connection timeout that I
am missing here? I would seriously like to use XML-PRC again on a new
project, but the socket timeout issue is a vote against it.

Any help with this would be kindly appreciated.

Thanks in advance,
Jason.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Itree Software         www.itree.com.au
 Ph (02)42263454        Fax (02)42263193
        -> Meeting your requirements.
        -> Delivering on promises.
        -> Pride in our work.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~