AutoBrowser Feature Can Cause Performance Issues

Issue

  • Jenkins is getting slow
  • Many threads/slow requests trying to guess SCM browser:
    hudson.model.Items.getAllItems(Items.java:353)
    jenkins.model.Jenkins.getAllItems(Jenkins.java:1444)
    hudson.scm.AutoBrowserHolder.infer(AutoBrowserHolder.java:77)
    hudson.scm.AutoBrowserHolder.get(AutoBrowserHolder.java:64)
    hudson.scm.SCM.getEffectiveBrowser(SCM.java:136)
  • For Pipeline Jobs, the slow request would look like the following:
[number]msec elapsed in Handling GET /master/job/myrepo/job/master/wfapi/runs from 127.0.0.1 : RequestHandlerThread[#123]
    [...]
    hudson.model.Items.getAllItems(Items.java:353)
    jenkins.model.Jenkins.getAllItems(Jenkins.java:1444)
    hudson.scm.AutoBrowserHolder.infer(AutoBrowserHolder.java:77)
    hudson.scm.AutoBrowserHolder.get(AutoBrowserHolder.java:64)
    hudson.scm.SCM.getEffectiveBrowser(SCM.java:136)
    org.jenkinsci.plugins.workflow.job.WorkflowRun.getChangeSets(WorkflowRun.java:677)

Environment

  • Jenkins
  • Jenkins LTS
  • CloudBees Jenkins Enterprise (CJE)

Related Issue(s)

Explanation

If no Repository Browser has been specified in the SCM configuration and no default repository browser exists, Jenkins search for similar projects in the system to infer the browser. This is inefficient because it requires a permission check for each item. It can cause performance issues, especially for large instances.

Resolution

The problem has been fixed in Jenkins core. The recommended solution is to upgrade Jenkins.

  • Jenkins: 2.9 or later
  • Jenkins LTS: 2.7.3 or later
  • CloudBees Jenkins Enterprise (CJE): 2.7.19.x or later

Workaround for Pipeline Jobs

If upgrading Jenkins is not an option and you are suffering from this issue due to Pipeline Jobs, the Pipeline Job Plugin provides a workaround in version 2.9+. See this PR.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.