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 Steven Terrell <St...@guideworkstv.com> on 2005/07/12 16:48:16 UTC

possible memory leak in HttpClient?

Folks,
   I am running load testing of my 3.0 RC3 HttpClient-based application.
After processing about 3.5 million requests (successfully), I find that the
jvm dies with an OutofMemory error. I am starting my process using Sun's
Java 1.5 with the following parms:
    java -server -Xss1M -Xms500M -Xmx500M -jar....

   I am running various memory profilers to see what the problem is. The
method that most often comes up in the profiler as a possible leak is
HttpClient.executeMethod(HostConfiguration, PostMethod, HttpState). Even
though the max heap is set for 500meg, the actual memory usae goes way
beyond that.

   My code has a Runnable class that is processed by a thread pool. The
Runnable class has a static instance of the MultiThreadedConnectionManager,
HostConfiguration, and HttpClient. In the run() method I declare the
PostMethod and HttpState. I typically run 100 threads in the thread pool,
and each thread is kept busy during the load testing. The
MultiThreadedConnectionManager opens 50 connections to each host (there is
only 1 host in the load test scenario.)

   I don't know if this is an actual leak, or a lack of garbage collection.
If anyone has any ideas on how to proceed with this, let me know. I would
appreciate your input!

Steve Terrell


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


Re: possible memory leak in HttpClient?

Posted by Michael Becke <mb...@gmail.com>.
Hi Steve,

Memory leaks are generally quite hard to pin down.  We've not heard of
any involving HttpClient previously, but there is always a first time.
 I would suggest testing with a pre 1.5 JVM, perhaps 1.4.2.

Also, as Gustavo mentioned some sample code, or even better a test
case that shows the problem would be great.

Mike

On 7/12/05, Steven Terrell <St...@guideworkstv.com> wrote:
> Folks,
>    I am running load testing of my 3.0 RC3 HttpClient-based application.
> After processing about 3.5 million requests (successfully), I find that the
> jvm dies with an OutofMemory error. I am starting my process using Sun's
> Java 1.5 with the following parms:
>     java -server -Xss1M -Xms500M -Xmx500M -jar....
> 
>    I am running various memory profilers to see what the problem is. The
> method that most often comes up in the profiler as a possible leak is
> HttpClient.executeMethod(HostConfiguration, PostMethod, HttpState). Even
> though the max heap is set for 500meg, the actual memory usae goes way
> beyond that.
> 
>    My code has a Runnable class that is processed by a thread pool. The
> Runnable class has a static instance of the MultiThreadedConnectionManager,
> HostConfiguration, and HttpClient. In the run() method I declare the
> PostMethod and HttpState. I typically run 100 threads in the thread pool,
> and each thread is kept busy during the load testing. The
> MultiThreadedConnectionManager opens 50 connections to each host (there is
> only 1 host in the load test scenario.)
> 
>    I don't know if this is an actual leak, or a lack of garbage collection.
> If anyone has any ideas on how to proceed with this, let me know. I would
> appreciate your input!
> 
> Steve Terrell
> 
> 
> ---------------------------------------------------------------------
> 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: possible memory leak in HttpClient?

Posted by Roland Weber <RO...@de.ibm.com>.
Hello Steve,

>    I don't know if this is an actual leak, or a lack of garbage 
collection.
> If anyone has any ideas on how to proceed with this, let me know. I 
would
> appreciate your input!

can you try to find out the class(es) of the objects clogging the memory?
The Heap Analysis Tool is supposed to provide instance counts:
http://java.sun.com/developer/onlineTraining/Programming/JDCBook/perf3.html

If it's an o.a.c.httpclient class, we'd know where to look.
Unfortunately, I haven't yet used this tool myself, so I can't
give you more specific advice.

hope that helps,
  Roland


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