You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Serge Knystautas <se...@lokitech.com> on 2002/01/28 22:26:37 UTC

HttpClient OutOfMemory continued

I got another OutOfMemory error, and I think it's because the connection (or
the method) is keeping a handle on what data is retrieved, and then it fails
while trying to get the content-length to read the headers.  Check out these
(believed) bugs in the code...

HttpMethodBase Line 1055: calls getResponseHeader with "Content-Length"...
should be "content-length" since getResponseHeader returns all lower case
HttpMethodBase Line 1056: same thing, different header
HttpMethodBase Line 454: same thing, different header
GetMethod Line 387: same thing, Content-Length again, and I think the source
of my problem

So, I would guess that the GetMethod is failing to get the expectedLength
Then it tries to parse the response and for whatever reason, the server does
not stop sending data when it should.  readResponseBody continues until it
runs out of memory.

Other notes for the record... this is on Win 2k w/256 megs RAM, mx size of
128 megs, the temp file that remained after the OutOfMemory was 128 megs
(the coincidence peaked my curiosity), it retrieved 76738 jpeg responses
successfully for about 1.9 gigs, and ran for about 47 hours before crashing.
This is actually the longest it had run before getting the OOM error.

Serge Knystautas
Loki Technologies - Unstoppable Websites
http://www.lokitech.com/


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: HttpClient OutOfMemory continued

Posted by Serge Knystautas <se...@lokitech.com>.
Doh, thanks... obviously misread that line.

Well, any ideas then why the code is ignoring the content-length and just
reads from the stream until the JVM dies?

Serge Knystautas
Loki Technologies - Unstoppable Websites
http://www.lokitech.com/
----- Original Message -----
From: "Andreas Erz" <ae...@ix.urz.uni-heidelberg.de>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Monday, January 28, 2002 5:07 PM
Subject: Re: HttpClient OutOfMemory continued


> Serge Knystautas wrote:
> SK> HttpMethodBase Line 1055: calls getResponseHeader with
"Content-Length"...
> SK> should be "content-length" since getResponseHeader returns all lower
case
> SK> HttpMethodBase Line 1056: same thing, different header
> SK> HttpMethodBase Line 454: same thing, different header
> SK> GetMethod Line 387: same thing, Content-Length again, and I think the
source
>
> getResponseHeader consists of this line:
>                   return
(Header)(responseHeaders.get(headerName.toLowerCase()));
>
> The header names are converted to lower case before looking up the
> values, so this does not seem to be a reason for a problem reading the
> headers.
>
> --
> Andreas Erz
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: HttpClient OutOfMemory continued

Posted by Andreas Erz <ae...@ix.urz.uni-heidelberg.de>.
Serge Knystautas wrote:
SK> HttpMethodBase Line 1055: calls getResponseHeader with "Content-Length"...
SK> should be "content-length" since getResponseHeader returns all lower case
SK> HttpMethodBase Line 1056: same thing, different header
SK> HttpMethodBase Line 454: same thing, different header
SK> GetMethod Line 387: same thing, Content-Length again, and I think the source

getResponseHeader consists of this line:
                  return (Header)(responseHeaders.get(headerName.toLowerCase()));

The header names are converted to lower case before looking up the
values, so this does not seem to be a reason for a problem reading the
headers.

--
Andreas Erz


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>