On Thu, 2006-11-09 at 18:05 +0200, Eugeny N Dzhurinsky wrote:
> On Thu, Nov 09, 2006 at 05:47:10PM +0200, Eugeny N Dzhurinsky wrote:
> > Hi there!
> > 
> > I was able to remove issues with host did not accept connection within 60
> > seconds with setting timeout to 5 minutes, but now I'm getting randomly
> > appearing errors like connection reset and read timed out. I was fighting 
> > with
> > similar errors for a week or more, but I was unable to find condition when 
> > such
> > errors occurs. The thing is when my application is getting such errors, I
> > still can open the pages which caused this error to appear, with Firefox - 
> > and
> > everything works fine. So is it something related to httpclient, or to JDK, 
> > or
> > to Linux?
> 

Eugeny,

The fact that it sort of always works with Firefox (or any other browser
for that matter) does not mean much to me, because we do not know how
many times Firefox retries the request before it succeeds in retrieving
the content of the URL.

> 
> Stack traces:
> 
> 10/Nov/2006 00:14:38 ERROR [pool-1-thread-1] - java.net.ConnectException: 
> Connection timed out
> java.net.ConnectException: Connection timed out
>         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:366)
>         at java.net.Socket.connect(Socket.java:516)
>         at java.net.Socket.connect(Socket.java:466)
>         at java.net.Socket.<init>(Socket.java:366)
>         at java.net.Socket.<init>(Socket.java:239)
>         at 
> org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.
> java:79)
>         at 
> org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$1.doit(ControllerThreadSocketFactory.java
> :90)
>         at 
> org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$SocketTask.run(ControllerThreadSocketFact
> ory.java:157)
>         at java.lang.Thread.run(Thread.java:595)
> 

What kind of JRE is your application running on? I suspect you are still
using a 1.3 JVM. Is that correct?


> 09/Nov/2006 17:28:44 ERROR [pool-1-thread-8] - java.net.SocketException: 
> Connection reset
> java.net.SocketException: Connection reset
>         at java.net.SocketInputStream.read(SocketInputStream.java:168)
>         at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
>         at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
>         at 
> org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)
>         at 
> org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)
>         at 
> org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1115)
>         at 
> org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedH
> ttpConnectionManager.java:1373)
>         at 
> org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)

-------------------------------^

This exception is perfectly legitimate. The server dropped the
connection before sending out a valid HTTP response, most likely due to
being under heavy load / running low on resources. This is not nice but
can be expected in the real life. Your code should implement a
recovery / retry mechanism to compensate for such failures

Oleg



>         at 
> org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)
>         at 
> org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
>         at 
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
>         at 
> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
>         at 
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
>         at 
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
> 


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

Reply via email to