Display URL API plugin causes a Classloading Bottleneck slowing down Jenkins

Article ID:360034330471
1 minute readKnowledge base

Issue

  • Jenkins has been running slowly when running many pipelines and many threads are stuck loading classes

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.

Resolution

Upgrade the Display URL API plugin to 2.3.2. This version is available in CloudBees Core, CloudBees Jenkins Enterprise, CloudBees Jenkins Platform and CloudBees Jenkins Distribution controllers in version 2.222.1.1 and higher.