groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Milles (JIRA)" <>
Subject [jira] [Commented] (GROOVY-8458) File leak in Eclipse Plugin
Date Mon, 02 Apr 2018 00:34:00 GMT


Eric Milles commented on GROOVY-8458:

Could you retest with the latest snapshot for Eclipse Oxygen (4.7.3)?  I was able to leverage
URLClassLoader implementing Closeable (since Java 7).  You can have a look at:

> File leak in Eclipse Plugin
> ---------------------------
>                 Key: GROOVY-8458
>                 URL:
>             Project: Groovy
>          Issue Type: Bug
>            Reporter: Peter Kriens
>            Priority: Blocker
> The Eclipse Groovy compiler opens JAR files that are on an Eclipse's project build path.
These JAR files are opened by Groovy but never closed.
> When a project changes its buildpath, the Groovy compiler keeps a reference to the old
file which makes it impossible to overwrite it on Windows.
> This is very visible in bnd(tools) environments because bnd creates an actual bundle
and puts this on the project's build path. Since every change results in a new bundle, the
build path is changed very frequently. However, once the Groovy compiler has its hands on
that JAR, bnd can no longer delete and its build fails.
> When we run an Eclipse workspace with a number of bnd projects we see a large number
of the following file leaks at the end.
> Looking at the source code it seems that you're opening a GroovyClassLoader, to get some
resources to find the AST transform services from it, and then never close it. So the JAR
files it accesses are then never closed. Which kind of is a problem on Windows ..
> []
> It seems putting this in a try/resource will solve the problem. 
> Although we did not detect leaks from different places, in our experience, these patterns
tend to happen frequently in a code base so it would be appreciated to do a check on any classloaders
(which are Java resources so you can get a warning from Eclipse when you forget to close
a Closeable resource) are not closed.
> Let me know if you prefer a pull request on Github.
> #95 C:\Users\-\com._______________\target\com._______________.jar by thread:Worker-11
on Wed Jan 24 10:30:25 CET 2018 at<init>( at
java.util.jar.JarFile.<init>( at java.util.jar.JarFile.<init>(
at sun.misc.URLClassPath$JarLoader.getJarFile( at sun.misc.URLClassPath$JarLoader.access$800(
at sun.misc.URLClassPath$JarLoader$ at sun.misc.URLClassPath$JarLoader$
at Method) at sun.misc.URLClassPath$JarLoader.ensureOpen(
at sun.misc.URLClassPath$JarLoader.<init>( at sun.misc.URLClassPath$
at sun.misc.URLClassPath$ at
Method) at sun.misc.URLClassPath.getLoader( at sun.misc.URLClassPath.getLoader(
at sun.misc.URLClassPath.getNextLoader( at sun.misc.URLClassPath.access$100(
at sun.misc.URLClassPath$ at sun.misc.URLClassPath$1.hasMoreElements(
at$3$ at$3$
at Method) at$
at$3.hasMoreElements( at
at sun.misc.CompoundEnumeration.hasMoreElements( at
at sun.misc.CompoundEnumeration.hasMoreElements( at org.codehaus.groovy.transform.ASTTransformationVisitor.doAddGlobalTransforms(
at org.codehaus.groovy.transform.ASTTransformationVisitor.addGlobalTransforms(
at org.codehaus.groovy.transform.ASTTransformationVisitor.addPhaseOperations(
at org.codehaus.groovy.control.CompilationUnit.<init>( at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyParser.makeCompilationUnit(
at org.codehaus.jdt.groovy.internal.compiler.ast.GroovyParser.<init>(
at org.codehaus.jdt.groovy.integration.internal.MultiplexingParser.dietParse(
at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile( at
org.eclipse.jdt.internal.compiler.Compiler.beginToCompile( at org.eclipse.jdt.internal.compiler.Compiler.compile(
at org.eclipse.jdt.internal.compiler.Compiler.compile( at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(
at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(
at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(
at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll( at
at$ at
at at
at$ at
at at
at at
at at

This message was sent by Atlassian JIRA

View raw message