hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HTTPCLIENT-841) potential memory leak when using ThreadSafeClientConnManager
Date Thu, 16 Apr 2009 11:33:18 GMT

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-841?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12699645#action_12699645
] 

Sebb commented on HTTPCLIENT-841:
---------------------------------

This may be completely off-base, but:

Is it possible that the RefQueueWorker shutdown() method was called directly, rather than
using the appropriate pool shutdown() method(s)?

[Maybe the RefQueueWorker shutdown() method should be package scope?]

Might be worth adding some debug code to check whether or not the refHandler resources have
all been released.
Not sure where to put this though, as RefQueueWorker.shutdown() is called first.

> potential memory leak when using ThreadSafeClientConnManager
> ------------------------------------------------------------
>
>                 Key: HTTPCLIENT-841
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-841
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.0 Beta 2
>         Environment: Leopard 10.5.6, Java 1.5.0_16, Jetty 6.1.7
>            Reporter: Ted Slusser
>             Fix For: 4.0 Beta 3
>
>
> When using ThreadSafeClientConnManager and developing with Jetty using auto-redeploy
feature eventually I run into a PermGen out of memory exception.  I investigated with YourKit
8.0.6 and found a class loader circular reference in RefQueueWorker.  Not really sure what
I was doing I made the refQueueHandler non-final and nulled it in the shutdown method of RedQueueWorker.
 I don't seem to have the problem any longer with circular class loader references.
> Here is a diff from 4.0-beta2
> --- httpclient/src/main/java/org/apache/http/impl/conn/tsccm/RefQueueWorker.jav(revision
763223)
> +++ httpclient/src/main/java/org/apache/http/impl/conn/tsccm/RefQueueWorker.jav(working
copy)
> @@ -50,7 +50,7 @@
>      protected final ReferenceQueue<?> refQueue;
>  
>      /** The handler for the references found. */
> -    protected final RefQueueHandler refHandler;
> +    protected RefQueueHandler refHandler;
>  
>  
>      /**
> @@ -112,6 +112,8 @@
>              this.workerThread = null; // indicate shutdown
>              wt.interrupt();
>          }
> +
> +        refHandler = null;
>      }
>  
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message