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

          many thanks for this very good analyses of the issue!

          Unfortunate I have no experience with the promoted builds plugin so its hard for me to reproduce the issue. Do you have a simple job config.xml I can import to reproduce the issue?

          Dominik Bartholdi added a comment - many thanks for this very good analyses of the issue! Unfortunate I have no experience with the promoted builds plugin so its hard for me to reproduce the issue. Do you have a simple job config.xml I can import to reproduce the issue?

          one more question: is your job within a folder or is it on top level?

          Dominik Bartholdi added a comment - one more question: is your job within a folder or is it on top level?

          Michael Wiles added a comment -

          Definitely top level. I have not used folders as yet.

          I suspect I'll be able to replicate this on a stand alone instance so I'll get it a go.

          Michael Wiles added a comment - Definitely top level. I have not used folders as yet. I suspect I'll be able to replicate this on a stand alone instance so I'll get it a go.

          that would be great, also the support zip generated by this plugin would be of big help: https://wiki.jenkins-ci.org/display/JENKINS/Support+Core+Plugin

          Dominik Bartholdi added a comment - that would be great, also the support zip generated by this plugin would be of big help: https://wiki.jenkins-ci.org/display/JENKINS/Support+Core+Plugin
          Michael Wiles made changes -
          Attachment New: config.xml [ 35345 ]
          Michael Wiles made changes -

          Michael Wiles added a comment - - edited

          config.xml is now attached.

          and you'll need org.jenkinsci.plugins.configfiles.GlobalConfigFiles.xml which goes in the "root" of Jenkins

          And you'll need promoted builds and config file provider plugin.

          But to reproduce manually:

          1. Install config provider plugin
          2. Install promoted builds plugin
          3. Create config file (custom config file)
          4. Create job (freestyle - I made mine just execute a shell (echo something))
          5. Create Promotion
          6. Add as step provide configuration files
          7. Run job (to make promotion available)
          8. Run promotion - promotion will hang at provisioning configuration files.

          Michael Wiles added a comment - - edited config.xml is now attached. and you'll need org.jenkinsci.plugins.configfiles.GlobalConfigFiles.xml which goes in the "root" of Jenkins And you'll need promoted builds and config file provider plugin. But to reproduce manually: Install config provider plugin Install promoted builds plugin Create config file (custom config file) Create job (freestyle - I made mine just execute a shell (echo something)) Create Promotion Add as step provide configuration files Run job (to make promotion available) Run promotion - promotion will hang at provisioning configuration files.

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

              Created:
              Updated:
              Resolved: