[ 
https://issues.apache.org/jira/browse/HTTPCLIENT-841?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Oleg Kalnichevski updated HTTPCLIENT-841:
-----------------------------------------

    Attachment: HTTPCLIENT-841.patch

Folks

I took a look at this issue and this is what I have to say. With Roland gone I 
do not see a way of coming up with a reliable fix for the problem without 
removing / disabling the connection garbage collection code. Moreover, I can't 
help thinking this feature causes more harm than good. It basically makes 
ThreadSafeClientConnManager, well, not thread safe. Personally I am prepared to 
go as far as breaking the API compatibility to have a better peace of mind 
about reliability of ThreadSafeClientConnManager and to simplify a fairly 
complex code, which all this GC magic makes even more complex.

I'll once again try to get in touch with Google folks to find out how they feel 
about possibility of breaking API / binary compatibility with Android.

I am attaching a patch that completely rips out garbage collection of 
connections.

Oleg

> 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
>
>         Attachments: HTTPCLIENT-841.patch
>
>
> 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-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to