You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Jonathan Hager <jh...@gmail.com> on 2008/04/01 20:01:48 UTC

Timeout on App Server - That goes away after restart

We are using HttpClient (3.x) on an application server to call a web
service.  This code has been deployed for over a year.  Yesterday,
after the application server had been running for 12 days, we started
getting connection time out errors.  Restarting the application server
fixed the issue.

My question is, what if anything, is potentially cached at the
application level (apparently the Http Client level its dependencies)
that could cause the host to stop resolving.  For example, if the DNS
changed for the server, is the DNS lookup cached at the VM level.
Alternatively, is the connection reused?

java.net.ConnectException: Connection timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
        at java.net.Socket.connect(Socket.java:452)
        at java.net.Socket.connect(Socket.java:402)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
        at sun.net.www.http.HttpClient.New(HttpClient.java:339)
        at sun.net.www.http.HttpClient.New(HttpClient.java:320)
        at sun.net.www.http.HttpClient.New(HttpClient.java:315)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:521)
        at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:498)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:626)
        at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:272)

Thanks
Jonathan

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: Timeout on App Server - That goes away after restart

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2008-04-01 at 11:01 -0700, Jonathan Hager wrote:
> We are using HttpClient (3.x) on an application server to call a web
> service.  This code has been deployed for over a year.  Yesterday,
> after the application server had been running for 12 days, we started
> getting connection time out errors.  Restarting the application server
> fixed the issue.
> 
> My question is, what if anything, is potentially cached at the
> application level (apparently the Http Client level its dependencies)
> that could cause the host to stop resolving.  For example, if the DNS
> changed for the server, is the DNS lookup cached at the VM level.

The resolved IPs are cached in the InetAddress class. For details see:

http://java.sun.com/j2se/1.4.2/docs/api/java/net/InetAddress.html 


> Alternatively, is the connection reused?
> 
> java.net.ConnectException: Connection timed out
>         at java.net.PlainSocketImpl.socketConnect(Native Method)
>         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
>         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
>         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
>         at java.net.Socket.connect(Socket.java:452)
>         at java.net.Socket.connect(Socket.java:402)
>         at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
>         at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
>         at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
>         at sun.net.www.http.HttpClient.<init>(HttpClient.java:306)
>         at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
>         at sun.net.www.http.HttpClient.New(HttpClient.java:339)
>         at sun.net.www.http.HttpClient.New(HttpClient.java:320)
>         at sun.net.www.http.HttpClient.New(HttpClient.java:315)
>         at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:521)
>         at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:498)
>         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:626)
>         at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:272)
> 

Please note you are using HttpURLConnection here, not HttpClient

Oleg


> Thanks
> Jonathan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org