cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Kulp (JIRA)" <>
Subject [jira] [Commented] (CXF-6749) Classloader leak on FileUtils.createTmpDir()
Date Mon, 18 Jan 2016 19:37:40 GMT


Daniel Kulp commented on CXF-6749:

There really isn't a way to completely avoid having the shutdown hook, even using Java7's
deleteOnExit stuff for directories, without causing a different memory leak.     I've added
a method to FileUtils to check if the temp dir is empty and remove the directory and hook
if it is.   I've updated the Servlet to call that method on destroy.   For MOST cases, that
should solve this.   If something is holding onto one of the temp files such that it hasn't
been deleted, it WILL attempt to gc()/runFinalizers() to get it released and re-check, but
if that doesn't cause the files to delete, it will leave the hook in place.  

For non-servlet uses of CXF, they can call the same method on FileUtils during whatever application
cleanups they do. (FileUtils.maybeDeleteDefaultTempDir())

> Classloader leak on FileUtils.createTmpDir()
> --------------------------------------------
>                 Key: CXF-6749
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.7.14
>         Environment: Slackware Linux 14.1 (kernel 3.10.17), Java 1.7.0_75, Tomcat 7.0.39
(this is my production environment)
>            Reporter: Diogo Sant'Ana
>              Labels: classloader-leak
> FileUtils.createTmpDir() adds a ApplicationShutdownHook to remove the recently created
temp folder, creating a indirect reference to the Tomcat WebappClassloader from the hook static
attribute at ApplicationShutdownHooks class, preventing the classloader to be collected.
> Actually, it will be collected when the JVM is turned off. But this is a web application
container, it won't be turn off for a while.
> I only checked this with the version I´m currently using (2.7.14), but I checked the
code at 3.1.x and master branches and it still the same.

This message was sent by Atlassian JIRA

View raw message