camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sanjay Deshmukh (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-6452) FileUtil.getDefaultTempDir() causes a classloader leak in webapps
Date Fri, 14 Jun 2013 02:35:20 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-6452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13683022#comment-13683022
] 

Sanjay Deshmukh commented on CAMEL-6452:
----------------------------------------

Hey Willem,

I had planned on leaving it up to the application to call this method when it is unloaded
from the app container. I suppose it could also be called from the shutdown routine of a CamelContext,
but then that assumes that the app only has one context.

The problem I'm running into is basically that any webapp that runs in an app container and
expects to be periodically reloaded will register a new shutdown hook in the same JVM each
time the app is loaded. Unless these hooks are removed when each instance is unloaded, all
the classloaders will remain in memory and the app container will eventually run out of PermGen
space.

Adding this optional cleanup method will enable apps that run in an app container to remove
their shutdown hook on their own so their classloaders can be garbage collected, and the app
container can continue on. Those apps who expect the JVM to terminate when they are finished
executing won't have to call it, and they will continue working as they do now.

Thanks!

Sanjay
                
> FileUtil.getDefaultTempDir() causes a classloader leak in webapps
> -----------------------------------------------------------------
>
>                 Key: CAMEL-6452
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6452
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.10.4
>         Environment: tomcat 7, spring 3.2
>            Reporter: Sanjay Deshmukh
>         Attachments: 0001-Fixed-CAMEL-6452-by-adding-a-cleanup-routine-to-remo.patch
>
>
> FileUtil.getDefaultTempDir() registers a JVM shutdown hook to delete the temporary directory
it creates. We are using camel in a web application in Tomcat that gets dynamically reloaded
as updates are available, so the JVM is normally never shut down. This is causing 'camel-tmp-*'
directories to linger in $CATALINA_HOME/temp, and - more importantly - classloader leaks,
which are a major problem for us.
> If the thread that gets registered as the shutdown hook were stored in a class variable,
I could unregister it when the application is being unloaded.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message