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

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

      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...

          [JENKINS-40803] Endless Loop when "provisoning config files..." when run from a build promotion

          Michael Wiles created issue -
          Michael Wiles made changes -
          Description Original: My symptom is when I click promote I get 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...

          Part of the stack trace is:

          {quote}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){quote}

          This method: getByIdOrNull at the plugin version I'm on (config files provider: 2.15.1) is the following:
          {code:java}
              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;
              }
          {code}

          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

          # Folder Plugins is installed but itemGroup is not an instance of AbstractFolder
          # JobPropertyImpl is not an instance of Item
          # 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...
          New: 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...

          Part of the stack trace is:

          {quote}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){quote}

          This method: getByIdOrNull at the plugin version I'm on (config files provider: 2.15.1) is the following:
          {code:java}
              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;
              }
          {code}

          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

          # Folder Plugins is installed but itemGroup is not an instance of AbstractFolder
          # JobPropertyImpl is not an instance of Item
          # 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...
          Michael Wiles made changes -
          Description Original: 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...

          Part of the stack trace is:

          {quote}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){quote}

          This method: getByIdOrNull at the plugin version I'm on (config files provider: 2.15.1) is the following:
          {code:java}
              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;
              }
          {code}

          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

          # Folder Plugins is installed but itemGroup is not an instance of AbstractFolder
          # JobPropertyImpl is not an instance of Item
          # 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...
          New: 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:

          {quote}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){quote}

          This method: getByIdOrNull at the plugin version I'm on (config files provider: 2.15.1) is the following:
          {code:java}
              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;
              }
          {code}

          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

          # Folder Plugins is installed but itemGroup is not an instance of AbstractFolder
          # JobPropertyImpl is not an instance of Item
          # 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...
          Michael Wiles made changes -
          Attachment New: config.xml [ 35345 ]
          Michael Wiles made changes -
          Michael Wiles made changes -
          Attachment New: support_2017-01-04_13.41.53.zip [ 35347 ]
          Dominik Bartholdi made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Dominik Bartholdi made changes -
          Status Original: In Progress [ 3 ] New: Open [ 1 ]
          Dominik Bartholdi made changes -
          Link New: This issue is related to JENKINS-41049 [ JENKINS-41049 ]
          Bryson Gibbons made changes -
          Link New: This issue is related to JENKINS-40728 [ JENKINS-40728 ]
          Dominik Bartholdi made changes -
          Component/s New: promoted-builds-plugin [ 15567 ]
          Component/s Original: config-file-provider-plugin [ 16140 ]

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

              Created:
              Updated:
              Resolved: