Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-37368

Serious performances issues caused by DownstreamPassCondition RunListener

      Issue

      The DownstreamPassCondition$RunListenerImpl causes serious performance issues for large instances.

      The current implementation of this Listener in Promoted Builds Plugin is terribly inefficient, especially in combination with Authorize Project Plugin.

      Also, a feature of the Maven Plugin seems to make use of it when checking for downstream/upstream statuses and changes:

      [...]
      hudson.security.ACL.hasPermission(ACL.java:73) 
      hudson.model.AbstractItem.hasPermission(AbstractItem.java:505) 
      hudson.model.Items.getAllItems(Items.java:365) 
      hudson.model.Items.getAllItems(Items.java:370) 
      hudson.model.Items.getAllItems(Items.java:346) 
      jenkins.model.Jenkins.getAllItems(Jenkins.java:1404) 
      hudson.plugins.promoted_builds.conditions.DownstreamPassCondition$RunListenerImpl.onCompleted(DownstreamPassCondition.java:220) 
      hudson.plugins.promoted_builds.conditions.DownstreamPassCondition$RunListenerImpl.onCompleted(DownstreamPassCondition.java:211) 
      hudson.model.listeners.RunListener.fireCompleted(RunListener.java:199) 
      hudson.maven.MavenBuild$ProxyImpl2.end(MavenBuild.java:602) 
      sun.reflect.GeneratedMethodAccessor1196.invoke(Unknown Source) 
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
      java.lang.reflect.Method.invoke(Method.java:606) 
      hudson.model.Executor$2.call(Executor.java:895) 
      hudson.util.InterceptingProxy$1.invoke(InterceptingProxy.java:23) 
      com.sun.proxy.$Proxy108.end(Unknown Source) 
      sun.reflect.GeneratedMethodAccessor18777.invoke(Unknown Source) 
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
      java.lang.reflect.Method.invoke(Method.java:606) 
      hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:608) 
      hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:583) 
      hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:542)
      

      Workaround:

      If you are not using DownstreamPassCondition in your jobs, a possible workaround is to disable the DownstreamPassCondition.RunListenerImpl:

      import hudson.plugins.promoted_builds.conditions.DownstreamPassCondition
      import jenkins.model.Jenkins
      
      Jenkins.instance.getExtensionList(DownstreamPassCondition.RunListenerImpl.class).each {
          it.unregister();
      }
      

      Link

      https://github.com/jenkinsci/promoted-builds-plugin/blob/promoted-builds-2.27/src/main/java/hudson/plugins/promoted_builds/conditions/DownstreamPassCondition.java#L263

          [JENKINS-37368] Serious performances issues caused by DownstreamPassCondition RunListener

          Arnaud Héritier added a comment - - edited

          oleg_nenashev are you maintaining this plugin to be the assignee or are you proposing yourself to help us on it ?
          Maybe with allan_burdajewicz we could help to propose a PR if you can guide us ?

          Arnaud Héritier added a comment - - edited oleg_nenashev are you maintaining this plugin to be the assignee or are you proposing yourself to help us on it ? Maybe with allan_burdajewicz we could help to propose a PR if you can guide us ?

          Oleg Nenashev added a comment -

          aheritier I kinda maintain it, but unfortunately I do not have much personal time for plugins. Too many TODOs in other areas. No chance to get anything fixed in this plugin by the end of September. Ownership of this plugin was a kind of the assignment by my employer, so you can follow-up with PMs if you want to get a short-term resolution.

          If you create a PR, I'll do my best to review and integrate it ASAP

          Oleg Nenashev added a comment - aheritier I kinda maintain it, but unfortunately I do not have much personal time for plugins. Too many TODOs in other areas. No chance to get anything fixed in this plugin by the end of September. Ownership of this plugin was a kind of the assignment by my employer, so you can follow-up with PMs if you want to get a short-term resolution. If you create a PR, I'll do my best to review and integrate it ASAP

          Oleg Nenashev added a comment -

          No capacity to work on it during my spare time.

          aheritier allan_burdajewicz if it still happens, you know the way to reescalate it

          Oleg Nenashev added a comment - No capacity to work on it during my spare time. aheritier allan_burdajewicz if it still happens, you know the way to reescalate it

          Code changed in jenkins
          User: Devin Nusbaum
          Path:
          src/main/java/hudson/plugins/promoted_builds/conditions/DownstreamPassCondition.java
          http://jenkins-ci.org/commit/promoted-builds-plugin/8fdcd8291815df5a9296397080ddb1d5f67c365b
          Log:
          JENKINS-37368 Improve performance in DownstreamPassCondition RunListener (#105)

          • JENKINS-37368 Improve performance of DownstreamPassCondition RunListener
          • Fix formatting by removing spaces around operators
          • Fix formatting by removing space around operators
          • Set EnvVars before impersonating SYSTEM
          • Check that the ItemGroup matches before checking for READ permission
          • Add test to asset that the SecurityContext is reset after calling DownstreamPassCondition's RunListener
          • Revert "Add test to asset that the SecurityContext is reset after calling DownstreamPassCondition's RunListener"

          This reverts commit 80b47493af341c06e91995bebc228f136c5b8345.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Devin Nusbaum Path: src/main/java/hudson/plugins/promoted_builds/conditions/DownstreamPassCondition.java http://jenkins-ci.org/commit/promoted-builds-plugin/8fdcd8291815df5a9296397080ddb1d5f67c365b Log: JENKINS-37368 Improve performance in DownstreamPassCondition RunListener (#105) JENKINS-37368 Improve performance of DownstreamPassCondition RunListener Fix formatting by removing spaces around operators Fix formatting by removing space around operators Set EnvVars before impersonating SYSTEM Check that the ItemGroup matches before checking for READ permission Add test to asset that the SecurityContext is reset after calling DownstreamPassCondition's RunListener Revert "Add test to asset that the SecurityContext is reset after calling DownstreamPassCondition's RunListener" This reverts commit 80b47493af341c06e91995bebc228f136c5b8345.

          Oleg Nenashev added a comment -

          It has been released in 2.29.1

          Oleg Nenashev added a comment - It has been released in 2.29.1

            dnusbaum Devin Nusbaum
            allan_burdajewicz Allan BURDAJEWICZ
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: