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

Performance Issue: JobDSL plugin creates folders All view with a localized name

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      The JobDSL plugin is creating folders with the all view as all view called `All` instead of `all`. After folders are created by the JobDSL plugin, the Jenkins system will thrash and update the folder configuration to rename the element from `All` to `all` (lowercased).

      Major performance issues are seen with JobDSLs configuring large numbers of views. Our system became nearly inoperable until an interim patch was applied.

      Please see JENKINS-38606 for the internal details of the issue.

      The fix is fairly trivial. A pull request with the fix for issue is available here:

      https://github.com/jenkinsci/job-dsl-plugin/pull/1148

        Attachments

          Activity

          Hide
          daspilker Daniel Spilker added a comment -

          Michael Ahern How can I reproduce the behavior?

          I am running Jenkins 2.121.1 in the official Docker container and installed Folder plugin 6.5.1. When I create a folder, the "All" view is named "All". An restarting Jenkins does not change that.

          <com.cloudbees.hudson.plugins.folder.Folder plugin="cloudbees-folder@6.5.1">
            <description/>
            <properties/>
            <folderViews class="com.cloudbees.hudson.plugins.folder.views.DefaultFolderViewHolder">
              <views>
                <hudson.model.AllView>
                  <owner class="com.cloudbees.hudson.plugins.folder.Folder" reference="../../../.."/>
                  <name>All</name>
                  <filterExecutors>false</filterExecutors>
                  <filterQueue>false</filterQueue>
                  <properties class="hudson.model.View$PropertyList"/>
                </hudson.model.AllView>
              </views>
              <tabBar class="hudson.views.DefaultViewsTabBar"/>
            </folderViews>
            <healthMetrics>
              <com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric>
                <nonRecursive>false</nonRecursive>
              </com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric>
            </healthMetrics>
            <icon class="com.cloudbees.hudson.plugins.folder.icons.StockFolderIcon"/>
          </com.cloudbees.hudson.plugins.folder.Folder>
          
          Show
          daspilker Daniel Spilker added a comment - Michael Ahern How can I reproduce the behavior? I am running Jenkins 2.121.1 in the official Docker container and installed Folder plugin 6.5.1. When I create a folder, the "All" view is named "All". An restarting Jenkins does not change that. <com.cloudbees.hudson.plugins.folder.Folder plugin= "cloudbees-folder@6.5.1" > <description/> <properties/> <folderViews class= "com.cloudbees.hudson.plugins.folder.views.DefaultFolderViewHolder" > <views> <hudson.model.AllView> <owner class= "com.cloudbees.hudson.plugins.folder.Folder" reference= "../../../.." /> <name>All</name> <filterExecutors> false </filterExecutors> <filterQueue> false </filterQueue> <properties class= "hudson.model.View$PropertyList" /> </hudson.model.AllView> </views> <tabBar class= "hudson.views.DefaultViewsTabBar" /> </folderViews> <healthMetrics> <com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric> <nonRecursive> false </nonRecursive> </com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric> </healthMetrics> <icon class= "com.cloudbees.hudson.plugins.folder.icons.StockFolderIcon" /> </com.cloudbees.hudson.plugins.folder.Folder>
          Hide
          iamahern Michael Ahern added a comment - - edited

          Daniel Spilker - so I was able to easily reproduce the issue using the LTS docker image. That is `Jenkins ver. 2.164.2` at the time of this writing.

          To reproduce:

          1. docker run -p 8080:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts
          2. On initial startup, install the "recommended" plugins - do not customize the list
          3. Install the JobDSL plugin
          4. Create a FreeStyle job CreateFolder
          5. Configure the free style job to have an inline DSL section and provide the snippet below:

           folder('GenFolder') {   displayName('GenFolder')   description('GenFolder') }

          1. Save 
          2. Run the CreateFolder Job
          3. Navigate in the Jenkins UI to the {{GenFolder}} directory (I get an error message in the UI, but this is fine)
          4. Navigate to the Logs page: `<your-server>/log/all`
          5. You should see the following log message: JENKINS-38606 detected for AllView in com.cloudbees.hudson.plugins.folder.Folder@38aa17c8[GenFolder]; renaming view from All to all

           

          This lines up with the expectations based on the Folder code:

          https://github.com/jenkinsci/cloudbees-folder-plugin/blob/e9a4d5b19e7db6021f81d2c4c8c2afa328e0d9f8/src/main/java/com/cloudbees/hudson/plugins/folder/AbstractFolder.java#L248

          If you look there, the code requires that a primaryView be defined when this block of code is hit. I am not sure of the exact situation necessary, but it is fairly common in the wild. Following the code for {{ migrateLegacyPrimaryAllViewLocalizedName }}:

          https://github.com/jenkinsci/cloudbees-folder-plugin/blob/e9a4d5b19e7db6021f81d2c4c8c2afa328e0d9f8/src/main/java/com/cloudbees/hudson/plugins/folder/views/DefaultFolderViewHolder.java#L176

          Under common conditions this will attempt to rename the view to {{ AllView.DEFAULT_VIEW_NAME }}. Checking that code: 

          https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/AllView.java#L61

          ...  AllView.DEFAULT_VIEW_NAME is "all" (in lowercase).

          Show
          iamahern Michael Ahern added a comment - - edited Daniel Spilker - so I was able to easily reproduce the issue using the LTS docker image. That is ` Jenkins ver. 2.164.2 ` at the time of this writing. To reproduce: docker run -p 8080:8080 -p 50000:50000 -v jenkins_home:/var/jenkins_home jenkins/jenkins:lts On initial startup, install the "recommended" plugins - do not customize the list Install the JobDSL plugin Create a FreeStyle job CreateFolder Configure the free style job to have an inline DSL section and provide the snippet below:   folder('GenFolder') {   displayName('GenFolder')   description('GenFolder') } Save  Run the CreateFolder Job Navigate in the Jenkins UI to the {{ GenFolder }} directory (I get an error message in the UI, but this is fine) Navigate to the Logs page: ` <your-server>/log/all ` You should see the following log message: JENKINS-38606 detected for AllView in com.cloudbees.hudson.plugins.folder.Folder@38aa17c8 [GenFolder] ; renaming view from All to all   This lines up with the expectations based on the Folder code: https://github.com/jenkinsci/cloudbees-folder-plugin/blob/e9a4d5b19e7db6021f81d2c4c8c2afa328e0d9f8/src/main/java/com/cloudbees/hudson/plugins/folder/AbstractFolder.java#L248 If you look there, the code requires that a primaryView be defined when this block of code is hit. I am not sure of the exact situation necessary, but it is fairly common in the wild. Following the code for {{ migrateLegacyPrimaryAllViewLocalizedName }}: https://github.com/jenkinsci/cloudbees-folder-plugin/blob/e9a4d5b19e7db6021f81d2c4c8c2afa328e0d9f8/src/main/java/com/cloudbees/hudson/plugins/folder/views/DefaultFolderViewHolder.java#L176 Under common conditions this will attempt to rename the view to {{ AllView.DEFAULT_VIEW_NAME }}. Checking that code:  https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/model/AllView.java#L61 ...  AllView.DEFAULT_VIEW_NAME is "all" (in lowercase).

            People

            • Assignee:
              daspilker Daniel Spilker
              Reporter:
              iamahern Michael Ahern
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: