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

Endless Loop when "provisoning config files..." when run from a build promotion

XMLWordPrintable

      My symptom is when I click promote I get the following output:

      Started by user XXX@mydomain.com
      Building on master in workspace /var/lib/jenkins/jobs/Package for Release /workspace
      Promoting JOB BEING PROMOTED
      provisoning config files...

      And it sits there...

      A snapshot of the stack trace is:

      at org.jenkinsci.plugins.configfiles.ConfigFiles.getByIdOrNull(ConfigFiles.java:82)
      at org.jenkinsci.plugins.configfiles.ConfigFiles.getByIdOrNull(ConfigFiles.java:103)
      at org.jenkinsci.plugins.configfiles.ConfigFiles.getByIdOrNull(ConfigFiles.java:114)
      at org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFileUtil.provisionConfigFiles(ManagedFileUtil.java:81)
      at org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep.perform(ConfigFileBuildStep.java:61)
      at hudson.plugins.promoted_builds.Promotion$RunnerImpl.build(Promotion.java:405)
      at hudson.plugins.promoted_builds.Promotion$RunnerImpl.doRun(Promotion.java:347)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
      at hudson.model.Run.execute(Run.java:1729)
      at hudson.model.Run.run(Run.java:1688)
      at hudson.plugins.promoted_builds.Promotion.run(Promotion.java:286)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:404)

      This method: getByIdOrNull at the plugin version I'm on (config files provider: 2.15.1) is the following:

          public static <T extends Config> T getByIdOrNull(@Nullable ItemGroup itemGroup, @NonNull String configId) {
      
              while (itemGroup != null) {
                  if (folderPluginInstalled() && itemGroup instanceof AbstractFolder) {
                      final AbstractFolder<?> folder = AbstractFolder.class.cast(itemGroup);
                      ConfigFileStore store = folder.getProperties().get(FolderConfigFileProperty.class);
                      if (store != null) {
                          Config config = store.getById(configId);
                          if (config != null) {
                              return (T) config;
                          }
                      }
                  }
                  if (itemGroup instanceof Item) {
                      itemGroup = Item.class.cast(itemGroup).getParent();
                  }
                  if (itemGroup instanceof Jenkins) {
                      // we are on top scope...
                      return (T) GlobalConfigFiles.get().getById(configId);
                  } else {
                      continue;
                  }
              }
      
              return null;
          }
      

      After attaching the debugger I've found that the reason I'm getting this behaviour is because this method does not return.

      It just loops around and around.

      The real type of the passed in itemGroup is hudson.plugins.promoted_builds.JobPropertyImpl

      1. Folder Plugins is installed but itemGroup is not an instance of AbstractFolder
      2. JobPropertyImpl is not an instance of Item
      3. JobPropertyImpl is not an instance of Jenkins either.

      So this method will never return.

      What is more is the configId that is passed in is valid as if I call GlobalConfigFiles.get().getById(configId); I get back what I expect.

      I suspect that 3rd condition probably needs to be relaxed a little...

        1. config.xml
          0.8 kB
          Michael Wiles
        2. org.jenkinsci.plugins.configfiles.GlobalConfigFiles.xml
          0.6 kB
          Michael Wiles

            farmgeek4life Bryson Gibbons
            michaelwiles Michael Wiles
            Votes:
            3 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: