Issue
-
Jenkins has been running slowly when running many pipelines and many threads are stuck loading classes
Environment
-
CloudBees CI (CloudBees Core) on modern cloud platforms - Managed controller
-
CloudBees CI (CloudBees Core) on modern cloud platforms - Operations Center
-
CloudBees CI (CloudBees Core) on traditional platforms - Client controller
-
CloudBees CI (CloudBees Core) on traditional platforms - Operations Center
-
CloudBees Jenkins Enterprise
-
CloudBees Jenkins Enterprise - Managed controller
-
CloudBees Jenkins Enterprise - Operations center
Symptoms
Inside of thread dumps on the Jenkins instance you will see a large number of threads similar to this:
<SOME THREAD> state:BLOCKED stackTrace: java.lang.Thread.State: BLOCKED (on object monitor) at java.lang.ClassLoader.loadClass(ClassLoader.java:404) - waiting to lock <SOME LOCK> (a hudson.PluginManager$UberClassLoader) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at org.jenkinsci.plugins.displayurlapi.DisplayURLContext.guessPlugin(DisplayURLContext.java:99) at org.jenkinsci.plugins.displayurlapi.DisplayURLContext.open(DisplayURLContext.java:125) at org.jenkinsci.plugins.displayurlapi.EnvironmentContributorImpl.buildEnvironmentFor(EnvironmentContributorImpl.java:17) at hudson.model.Run.getEnvironment(Run.java:2382) at hudson.model.AbstractBuild.getEnvironment(AbstractBuild.java:872) ...
With a single thread causing the blockage most likely with a very similar stack trace. This would indicate you are suffering from this issue but does not guarantee that the issue is caused by the Display URL API plugin.
Cause
As explained in this issue JENKINS-58654 the Display URL API plugin loads classes for loading the context of previous builds which can create a bottleneck of classloading that leads to Jenkins slowing down.