-
Improvement
-
Resolution: Unresolved
-
Major
-
-
2.312
When running on Java 7, Jenkins should ensure that all its ClassLoader instances are marked parallel-capable. This would improve class loading speed in some circumstances—mainly during startup or when first using new features, but also when searching for Groovy imports and the like.
At least UberClassLoader, DependencyClassLoader, AntClassLoader2, and PluginFirstClassLoader should be so marked. (PluginFirstClassLoader ought to be made to extend AntClassLoader2 since we control it; all superclasses must be marked.) To work on Java 7, can use this idiom:
try { Method m = ClassLoader.class.getDeclaredMethod("registerAsParallelCapable"); m.setAccessible(true); boolean b = (Boolean) m.invoke(null); if (!b) { ...warn... } } catch (NoSuchMethodException x) { // fine, Java 6 } catch (Exception x) { ...warn... }
(Unfortunately this pattern must be repeated in such class, since registerAsParallelCapable is caller-sensitive.)
- is blocked by
-
JENKINS-66993 java.lang.LinkageError: loader jenkins.util.AntClassLoader attempted duplicate abstract class definition
-
- Closed
-
- is related to
-
JENKINS-65811 Script Security causes bottleneck on caffeine cache
-
- Open
-
-
JENKINS-24309 UberClassLoader does not cache negative results
-
- Resolved
-
- relates to
-
JENKINS-65766 java.lang.LinkageError: ... attempted duplicate class definition for name: ...
-
- Closed
-
-
JENKINS-64479 deadlock in logging and classloading
-
- Closed
-
- links to
I can make CpsVmExecutorService set a more appropriate context loader, which perhaps helps unblock some of these, but others are apparently initiated on the application class loader and so still block. (This is not Jenkins code, so making Jenkins plugin class loaders parallel-capable would not help.)
Regardless, after a while the system becomes slower and slower and memory usage grows to extreme levels (for example, over 3m instances of java.lang.reflect.Method such as X058.super$1$notify, consuming 268Mb excluding retained objects, after running a few hundred builds). Even after stopping all builds and letting the system go idle, manual GC does not help much. Unfortunately I have not had any success identifying root references.