CloudBees Plugin Usage Analyzer plugin 2.x slows down controller start up

Article ID:360054879991
1 minute readKnowledge base

Issue

  • After installing CloudBees Plugin Usage Analyzer plugin 2.x (< 2.6) and restarting a Jenkins controller, the web UI displays the "Please wait while Jenkins is getting ready to work" message for an unusually long period of time.

  • After upgrading a Jenkins controller, the web UI displays the "Please wait while Jenkins is getting ready to work" message for an unusually long period of time.

  • When collecting a thread dump, we see a runnable thread like the following:

      "AnalyzerWork.initialize" #27 daemon prio=5 os_prio=0 tid=0x00007fa11837e000 nid=0x3e runnable [0x00007fa13577e000]
         java.lang.Thread.State: RUNNABLE
          at java.util.regex.Pattern.RemoveQEQuoting(Pattern.java:1596)
          at java.util.regex.Pattern.compile(Pattern.java:1689)
          at java.util.regex.Pattern.<init>(Pattern.java:1352)
          at java.util.regex.Pattern.compile(Pattern.java:1028)
          [...]
          at com.cloudbees.jenkins.plugins.pluginusage.v2.Analysis.fromJSON(Analysis.java:244)
          at com.cloudbees.jenkins.plugins.pluginusage.v2.Analysis.fromFile(Analysis.java:261)
          at com.cloudbees.jenkins.plugins.pluginusage.v2.analyzers.SnapshotAnalyzer.load(SnapshotAnalyzer.java:21)
          at com.cloudbees.jenkins.plugins.pluginusage.v2.analyzers.Analyzer.init(Analyzer.java:101)
          at com.cloudbees.jenkins.plugins.pluginusage.v2.AnalyzerWork.initialize(AnalyzerWork.java:44)
  • With start up performance logs enabled (see How to Troubleshoot and Address Jenkins Startup Performances), when Jenkins eventually starts the startup logs show that the AnalyzerWork.initialize had taken a very long time:

      INFO  jenkins.model.Jenkins$5#runTask: Took <timeInMillis>ms for AnalyzerWork.initialize by <threadName>
  • FNDJEN-3360: Performance issue reading Plugins Usage Analysis file when starting the instance

Explanation

The CloudBees Plugin Usage Analyzer plugin version 2.x initialization - AnalyzerWork.initialize task - reads an analysis report on start up that can take several minutes depending on the environment. This process is synchronous and Jenkins will not be fully loaded until it completes.

There is an issue that captured this problem FNDJEN-3360: Performance issue reading Plugins Usage Analysis file when starting the instance.

Workaround

The workaround if impacted is to

this issue is only a problem on start up. Another workaround is to remove the file $JENKINS/pup/analysis.json before starting / restarting Jenkins.