On Fri, 2012-05-04 at 08:59 +0200, Daniel Stucky wrote:
> Hi,
> 
> the SMILA project uses HttpClient 4.1.2 and is very happy with it.
> 
> In order to improve system availability and reliability we did some tests on 
> "what happens to the HTTP communication on disconnects" (e.g. a physical 
> disconnect of the network cable).
> As it is not possible to check beforehand if a connection is available and an 
> operation is executable successfully we experimented with timeouts:
> 
> Using something like
> client.getParams().setParameter(HttpConnectionParams.SO_TIMEOUT, 30000);
> helps when reading data from a server response.
> 
> But what about writing to the server ? Checking the documentation and the 
> code  we could not find anything that addresses timeouts on write operations.
> The current behavior on my machine (Ubuntu 10) is that the call blocks for 
> about 15 minutes and then the following exception is thrown:
> 
> do_ypcall: clnt_call: RPC: Unable to send; errno = Network is unreachable
> YPBINDPROC_DOMAIN: Domain not bound
> java.net.UnknownHostException: <machine-name>
>             at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
>             at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:850)
>             at 
> java.net.InetAddress.getAddressFromNameService(InetAddress.java:1201)
>             at java.net.InetAddress.getAllByName0(InetAddress.java:1154)
>             at java.net.InetAddress.getAllByName(InetAddress.java:1084)
>             at java.net.InetAddress.getAllByName(InetAddress.java:1020)
>             at 
> org.apache.http.impl.conn.DefaultClientConnectionOperator.resolveHostname(DefaultClientConnectionOperator.java:242)
>             at 
> org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:130)
>             at 
> org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
>             at 
> org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:121)
>             at 
> org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:573)
>             at 
> org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:425)
>             at 
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
>             at 
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
>             at 
> org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732)
>             at ...
> 
> Is there anything we can do to improve the situation with write operations ?
> This is critical because HTTP communication consists always of write/read 
> pairs (from the client perspective).
> 
> Bye,
> Daniel
> 

Java classic (blocking) i/o model does not support timeouts on write
operations. There is not much we can do about it. However, if the
connection gets reset during a write operation I believe the operation
should get unblocked with a SocketException of some sort. Unfortunately
I cannot say if unplugging the cable should be enough to simulate a
connection reset.

Oleg 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to