You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org> on 2010/05/13 05:48:42 UTC

[jira] Commented: (TOMAHAWK-1443) StreamingAddResource introduces memory leak

    [ https://issues.apache.org/jira/browse/TOMAHAWK-1443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12866949#action_12866949 ] 

Leonardo Uribe commented on TOMAHAWK-1443:
------------------------------------------

I have attached a proposal to this one.

The idea is create two classes: StreamingDestroyerListener and StreamingThreadManager. The first one is used to init and destroy the second one. StreamingThreadManager will be responsible to have all HeaderInfoEntry instances and init and destroy the cleanup thread. 

It is necessary to do some changes, introduce a new abstract class called AddResource2 that implements AddResource interface with an alternate method  responseStarted(Object context, Object request), so we can retrieve the StreamingThreadManager instance from context object.

I think we can take advantage of jdk 1.5 features (use AtomicLong instead a synchronized block) but for now it is better to keep things simple.

Suggestions are welcome. If no objections, I'll commit this code, but I'll let some time before that. This bug affects core12 and core20, but after commit on core module, the code will automatically transferred to core12 and core20 (because thanks to myfaces builder plugin unpack goal, we can share code for all branches!)

> StreamingAddResource introduces memory leak
> -------------------------------------------
>
>                 Key: TOMAHAWK-1443
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1443
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>    Affects Versions: 1.1.7
>            Reporter: Philipp Schoepf
>         Attachments: TOMAHAWK-1443-1.patch
>
>
> org.apache.myfaces.component.html.util.StreamingAddResource creates a Thread named CleanupThread. This causes a memory during development when an application is uninstalled/installed during development.
> The thread is unmanaged to the server and will hold references to the application classloader, even if the application is uninstalled from the server.
> The same problem will occur in production environments that use hot deploy features.
> I don't know if this does also affect 1.2.x stream.
> Suggestion: Please include a shutdown hook that can be used to stop the thread during application shutdown (via ContextLoaderListener or similar).

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