On Thu, 2008-01-24 at 17:26 +0100, Cyril Jaquier wrote: > Hi all, > > We are using HttpClient 3.1 on PC and PDA (Windows Mobile). On PDA, we > get from time to time InterruptedIOException. > > java.io.InterruptedIOException: The operation timed out > at java.net.SocketImpl.receiveStreamImpl(Native Method) > at java.net.SocketImpl.read(Unknown Source) > at java.net.SocketInputStream.read(Unknown Source) > at java.net.SocketInputStream.read(Unknown Source) > at java.io.BufferedInputStream.fillbuf(Unknown Source) > at java.io.BufferedInputStream.read(Unknown Source) > at org.apache.commons.httpclient.ChunkedInputStream.read(Unknown Source) > at org.apache.commons.httpclient.ChunkedInputStream.read(Unknown Source) > at > org.apache.commons.httpclient.ChunkedInputStream.exhaustInputStream(Unknown > Source) > at org.apache.commons.httpclient.ChunkedInputStream.close(Unknown > Source) > at java.io.FilterInputStream.close(Unknown Source) > at > org.apache.commons.httpclient.AutoCloseInputStream.notifyWatcher(Unknown > Source) > at org.apache.commons.httpclient.AutoCloseInputStream.close(Unknown > Source) > at java.io.FilterInputStream.close(Unknown Source) > at java.io.FilterInputStream.close(Unknown Source) > at java.io.FilterInputStream.close(Unknown Source) > at java.util.zip.InflaterInputStream.close(Unknown Source) > > We close all our streams before calling releaseConnection(). Do we need > to do this?
Cyril, You do not have to close the input stream returned by #getResponseBodyAsStream, as it is not guaranteed to close the underlying socket (in fact #releaseConnection() will be called behind the scene) but generally it is a good practice to do so. > Should we call releaseConnection() BEFORE closing the streams? > No. > About the above exception, I guess that the underlaying GPRS connection > (or the server!?) went away right before closing the stream. And as > ChunkedInputStream.close() does not close the stream but tries to read > more data, this InterruptedIOException is thrown. > > Could we just ignore this exception or do we need to cleanup something > else in this case? > I _suspect_ the server simply fails to send the closing chunk. If the message body appears to be in a consistent state you can just ignore the exception. You might want to investigate a little further, though. Enable the wire log and see if the closing chunk is indeed missing. Hope this helps Oleg > Thank you. > > Regards, > > Cyril Jaquier > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
