Am 24.08.2015 09:37, schrieb Cedric Champeau:
Hi,
Sterling and I have been investigating the intermittent PermGen space
errors that occur to the build. It seemed to became much worse with the
upgrade to Groovy 2.4.4 on master.
then I would suggest doing a bisect to find the version that is causing the problem.
[...]
It will systematically fail with an OOM, and what the dump shows is a
lot of org.codehaus.groovy.util.ReferenceType$SoftRef classes, which
should normally be released when their referenced class is freed.
The managing of the reference is unchanged since late 1.6 I think, but it is done like this: for the first 500 references (see ReferenceManager:155) we don't poll the reference queue at all. That means even if the referenced Object is already garbage, the SoftRef will continue to exist. The next time a SoftRef is created we check the queue for garbage object and clean the SoftRef. After that the SoftRef itself is garbage and should be collected via normal garbage collection - next time that is.
So it is necessarily strange to have many SoftRef instances.
However, analyzing the heap dump, I found this:
Images intégrées 1
As you can see, the class which is still loaded is CodeNarcTask. I
wonder why we have it although CodeNarc checks are not yet executed.
checks are not executed, but there might be extension methods, it might be that something was called on the class, for example to inspect it. there are many possibilities. You would have to set a break point in the ClassInfo/MetaClass generation to see why
Whatever random Ref I choose, through a chain of "next" member, I will
end up to this CodeNarcTask class, which prevents unloading.
why does the CodeNarcTask prevent unloading?
bye blackdrag
--
Jochen "blackdrag" Theodorou
blog: http://blackdragsview.blogspot.com/
--
You received this message because you are subscribed to the Google Groups "gradle-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gradle-dev+...@googlegroups.com.
To post to this group, send email to gradl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gradle-dev/55DADB61.4010201%40gmx.org.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/gradle-dev/CAPHf-2eCQW%2BqmSPQgWBqwW%3DWx7cUq0epXo2nZh2NDFmK0f-fPg%40mail.gmail.com.
--
You received this message because you are subscribed to the Google Groups "gradle-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gradle-dev+...@googlegroups.com.
To post to this group, send email to gradl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gradle-dev/55DC1723.50405%40gmx.org.
package doNotCommit;
import java.io.File;
import java.net.URL;
import java.net.URLClassLoader;
public class PermGenLeak {
public static final String GROOVY_JAR = "/home/cchampeau/.gvm/groovy/2.4.4/lib/groovy-2.4.4.jar";
public static void main(String[] args) throws Exception {
int i = 0;
try {
while (true) {
i++;
URLClassLoader loader = new URLClassLoader(
new URL[] { new File(GROOVY_JAR).toURI().toURL() },
ClassLoader.getSystemClassLoader().getParent());
Class system = loader.loadClass("groovy.lang.GroovySystem");
system.getDeclaredMethod("getMetaClassRegistry").invoke(null);
system.getDeclaredMethod("stopThreadedReferenceManager").invoke(null);
loader.close();
System.gc();
System.out.println("That's your chance to take a heap dump!");
Thread.sleep(4000);
}
} catch (OutOfMemoryError e) {
System.err.println("Failed after " + i + " loadings");
}
}
}
On 30 August 2015 at 7:50:42 am, Cedric Champeau (ced...@gradle.com) wrote:
So here is a summary of my findings: http://melix.github.io/blog/2015/08/permgenleak.htmlAs you will see, this is far as simple as a leak in CodeNarc....
--
You received this message because you are subscribed to the Google Groups "gradle-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gradle-dev+...@googlegroups.com.
To post to this group, send email to gradl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gradle-dev/c91d685e-9d71-4932-a244-b6ec1366ed17%40googlegroups.com.