RequesterRecipientProvider.java hangs when a build is upstream of itself

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      When using the RequesterRecipientProvider class, it can get stuck in an infinite loop if a build ends up being upstream of itself.  The root cause looks to be in the plugin that provides "Rebuild" as an option, but nonetheless this code should handle the case where the build's upstream build is itself to prevent an infinite loop.

      https://github.com/jenkinsci/email-ext-plugin/blob/master/src/main/java/hudson/plugins/emailext/plugins/recipients/RequesterRecipientProvider.java#L55 

      cur = p.getBuildByNumber(upc.getUpstreamBuild());

      could be changed to the following to prevent an infinite loop

      Run<?, ?> upstreamBuild = p.getBuildByNumber(upc.getUpstreamBuild());
      if(cur == upstreamBuild) {
          context.getListener().getLogger().print("Somehow build " + cur + " is upstream of itself");
          break;
      }

            Assignee:
            Unassigned
            Reporter:
            pixman20
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: