The information in 4746367 suggests that we have a client sending
a serialized object via HTTP to a servlet but the servlet is
seeing a premature EOF and a StreamCorruptedException is thrown.
The analysis in 4746367 is based on 1.3.1_04 which has a number of
bugs in its handling of persistent connections. All of these
problems have been addressed in 1.4 and 1.4.1 and there should now
be no possibility of prematurely closing a non-idle connection.
The submiter has, however, confirmed that the exceptions have been
observed when using 1.4.1_01. We need a trace of the problem with
1.4.1_01 to diagnose the issue further - with 1.4.1 the only
possibility of premature close whilst streaming the request is if
HttpURLConnection's disconnect method is called to disconnect the
The issue is now understood and does relates to the use of the
disconnect method. disconnect is blindly closing the connection to
the server irrespective of the state of the http request. If the
response has been read to EOF the connection is returned to the
keep-alive cache and could be allocated to another http request.
Calling disconnect can thus cause havoc for this other request.