-
Notifications
You must be signed in to change notification settings - Fork 900
Conversation
…r associated class loaders.
(checkpoint) changes so far look ok to me, but I lack the context to be certain |
Actually not looking too bad at the moment in Java 8. If I set the job to rebuild itself repeatedly (once per second), and monitor the class count, it climbs to around 50–60 before spontaneously clearing. The
or from VisualVM:
|
Java 7 shows the same behavior of |
On a lark I tried org.codehaus.groovy.util.ReferenceBundle.softBundle.type = org.codehaus.groovy.util.ReferenceBundle.weakBundle.type but it does not seem to help. |
Well even on Java 7 (u67) the permanent generation does apparently get collected if you are just patient enough; takes around 1000 |
So the main thing so far has been the upgrade of |
And clearing the |
@reviewbybees ready to merge from my perspective. |
👍 |
When running a flow repeatedly, the
WorkflowScript
(a dynamicCpsScript
subclass) is not promptly collected, nor is itsGroovyClassLoader.InnerLoader
and thus an assortment of derivative classes and objects. Demo:prints the number of builds you have just run. (Note that each line is a class called
WorkflowScript
from its own class loader.)I think I have fixed all the hard-reference leaks, so Jenkins will collect the remaining
SoftReference
s under heavy memory pressure rather than throwing anOutOfMemoryError
; to demo, using the current patch run in/script
and the
WorkflowScript
count will drop to 0. Sometimes this also happens after merelyBut in the meantime the heap (or in Java 6/7, permanent generation) slowly grows.
@reviewbybees (ref. ZD-24759)
CpsFlowExecution.shell
leakCaller.Info
leakSerializableClassRegistry
leak (arguably a bug in JBoss Marshalling, though JDK-6389107 makes it hard to fix)java.beans.Introspector
leak (also related to JDK-6389107)org.codehaus.groovy.reflection.ClassInfo$ClassInfoSet$Segment.table
leak, or hope that groovy/groovy-core@97d78e9 in 2.4.0-beta-2 solves this (cf. [JENKINS-21249] Updated Groovy to 2.4.5 jenkins#1085)