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 denizen <ne...@gmail.com> on 2006/03/24 23:53:59 UTC

SocketTimeoutException

I've researched this to the point of exhaustion and i'm not sure what
to do with the error that i'm seeing.  I have a java app that uses
httpclient.  I've run and compiled it with many (i've been working on
this problem for a week) different combinations of java runtimes, sdks
and platforms.

I have reduced the code down to a small amount of code that downloads
a file from a single server and saves it to the local hard drive.  The
file is 500k in size...

The basic issue is this:  the code works perfectly and even flawlessly
on all my test platforms except two.  An XP machine using 1.4.2_04 and
a Mac iBook running apple's own java 1.3.1.  On both of these machines
I get a SocketTimeoutException when reading the file and writing it to
disk.  I've turned on debug logging and it gets through about 100k of
the file before it times out.

I have played with the timeout settings...no matter what the setting,
it will eventually timeout unless i don't set a timeout and then it
hangs.

I have tried downloading the same file using other methods on the same
machine (IE, Firefox, etc)  These all work fine.

I have tried different combinations of getResponseBody() and
getResponseBodyAsStream() and so on...i've tried closing the
connection before I write the file, i've tried not writing the file at
all...it still timesout on the network read.

I'm now thinking about implementing byte ranges in http to get the
entire file but i've got the distinct impression that i'm missing
something.

It seems like others might be having similar problems from my google
searches but the threads meander and ultimately don't result in
anything other than the obvious "set the timeout value" advice.

I can't just ignore these machines because we have customers that are
having the same problems so I have to identify this issue and fix it
if possible but I don't know where to go from here.

Any help at all would be greatly appreciated!

Thanks
Dennis

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


Re: SocketTimeoutException

Posted by denizen <ne...@gmail.com>.
We tried 1.5, various versions of 1.4.2 and 1.31 on the windows
machine...on the Mac we only had the choice of 1.3.1 and 1.4.2...

I'll look at the SSL guide and try that to see whats going
on...although it is not an ssl connection.

thx
Dennis

On 3/24/06, Oleg Kalnichevski <ol...@apache.org> wrote:
> denizen wrote:
> > I've researched this to the point of exhaustion and i'm not sure what
> > to do with the error that i'm seeing.  I have a java app that uses
> > httpclient.  I've run and compiled it with many (i've been working on
> > this problem for a week) different combinations of java runtimes, sdks
> > and platforms.
> >
> > I have reduced the code down to a small amount of code that downloads
> > a file from a single server and saves it to the local hard drive.  The
> > file is 500k in size...
> >
> > The basic issue is this:  the code works perfectly and even flawlessly
> > on all my test platforms except two.  An XP machine using 1.4.2_04 and
> > a Mac iBook running apple's own java 1.3.1.  On both of these machines
> > I get a SocketTimeoutException when reading the file and writing it to
> > disk.  I've turned on debug logging and it gets through about 100k of
> > the file before it times out.
> >
> > I have played with the timeout settings...no matter what the setting,
> > it will eventually timeout unless i don't set a timeout and then it
> > hangs.
> >
> > I have tried downloading the same file using other methods on the same
> > machine (IE, Firefox, etc)  These all work fine.
> >
> > I have tried different combinations of getResponseBody() and
> > getResponseBodyAsStream() and so on...i've tried closing the
> > connection before I write the file, i've tried not writing the file at
> > all...it still timesout on the network read.
> >
> > I'm now thinking about implementing byte ranges in http to get the
> > entire file but i've got the distinct impression that i'm missing
> > something.
> >
> > It seems like others might be having similar problems from my google
> > searches but the threads meander and ultimately don't result in
> > anything other than the obvious "set the timeout value" advice.
> >
> > I can't just ignore these machines because we have customers that are
> > having the same problems so I have to identify this issue and fix it
> > if possible but I don't know where to go from here.
> >
> > Any help at all would be greatly appreciated!
> >
> > Thanks
> > Dennis
> >
> Dennis,
>
> The usual recommendation in such cases is to upgrade the JRE to the
> latest patch level, because this problem may well be JRE dependent. You
> may try the same technique as described in the SSL guide to see if you
> can actually download the file at all using a raw socket:
>
> http://jakarta.apache.org/commons/httpclient/sslguide.html#Troubleshooting
>
> Oleg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>

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


Re: SocketTimeoutException

Posted by Oleg Kalnichevski <ol...@apache.org>.
denizen wrote:
> I've researched this to the point of exhaustion and i'm not sure what
> to do with the error that i'm seeing.  I have a java app that uses
> httpclient.  I've run and compiled it with many (i've been working on
> this problem for a week) different combinations of java runtimes, sdks
> and platforms.
>
> I have reduced the code down to a small amount of code that downloads
> a file from a single server and saves it to the local hard drive.  The
> file is 500k in size...
>
> The basic issue is this:  the code works perfectly and even flawlessly
> on all my test platforms except two.  An XP machine using 1.4.2_04 and
> a Mac iBook running apple's own java 1.3.1.  On both of these machines
> I get a SocketTimeoutException when reading the file and writing it to
> disk.  I've turned on debug logging and it gets through about 100k of
> the file before it times out.
>
> I have played with the timeout settings...no matter what the setting,
> it will eventually timeout unless i don't set a timeout and then it
> hangs.
>
> I have tried downloading the same file using other methods on the same
> machine (IE, Firefox, etc)  These all work fine.
>
> I have tried different combinations of getResponseBody() and
> getResponseBodyAsStream() and so on...i've tried closing the
> connection before I write the file, i've tried not writing the file at
> all...it still timesout on the network read.
>
> I'm now thinking about implementing byte ranges in http to get the
> entire file but i've got the distinct impression that i'm missing
> something.
>
> It seems like others might be having similar problems from my google
> searches but the threads meander and ultimately don't result in
> anything other than the obvious "set the timeout value" advice.
>
> I can't just ignore these machines because we have customers that are
> having the same problems so I have to identify this issue and fix it
> if possible but I don't know where to go from here.
>
> Any help at all would be greatly appreciated!
>
> Thanks
> Dennis
>   
Dennis,

The usual recommendation in such cases is to upgrade the JRE to the 
latest patch level, because this problem may well be JRE dependent. You 
may try the same technique as described in the SSL guide to see if you 
can actually download the file at all using a raw socket:

http://jakarta.apache.org/commons/httpclient/sslguide.html#Troubleshooting

Oleg

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