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

SCM polling always fails using Perforce plugin due to "workspace offline" and causes infinite build loop

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      1. Set up an "in demand" slave.
      2. Set up a project that only builds on that slave
      3. The slave will go offline
      4. The SCM poll will see that the workspace is offline and trigger a new build
      5. The slave comes online, the build completes
      6. The slave goes back offline again as in 3.
      7. And here the infinite build loop happens since we now send up back at 4

      I'm not sure why Hudson is trying to get the content of the workspace? The perforce plugin knows the last change list number used for the last build, so it should also know by polling perforce that the last changlist number is different and so a build should be triggered?

      In our environment each slave is actually a virtual machine controlled by scripts, after a build completes its taken offline so checking the workspace will NEVER work. This completely breaks our setup because builds are only set to trigger for SCM changes.

      When a slave is brought back online the VM is reverted to its snapshot to ensure the build is "clean", so again this means checking the workspace content will always fail.

        Attachments

          Activity

          Hide
          martinfr martin franklin added a comment -

          Dont think it's worth it to issue a NPE given that the code I was using was so out of date.

          Show
          martinfr martin franklin added a comment - Dont think it's worth it to issue a NPE given that the code I was using was so out of date.
          Hide
          martinfr martin franklin added a comment -

          Here's the patch I've created which 'gets this working' in a limited sense.

          If requiresWorkspaceForPolling returns false then you can perform a poll on the master without a node or a workspace. This is what previously worked for us, we just set the slave client format to ${basename}.

          Then the AbstractProject class calls scm.pollChanges(this, null, null, listener);

          I've changed the code so that if no buildnode is found, instead of just returning false, pollchanges further also checks to see if requiresWorkspaceForPolling returns false. If so it just proceeds to use the master as previously in 1.1.0.

          I havent completely tested this yet. But my preliminary tests seem to show that it works.

          I believe that my NPE's are related to AbstractProject invoking pollChanges with launcher and workspace set to null. If I still see these occuring I'll file a NPE issue and try to create another patch.

          Martin

          Show
          martinfr martin franklin added a comment - Here's the patch I've created which 'gets this working' in a limited sense. If requiresWorkspaceForPolling returns false then you can perform a poll on the master without a node or a workspace. This is what previously worked for us, we just set the slave client format to ${basename}. Then the AbstractProject class calls scm.pollChanges(this, null, null, listener); I've changed the code so that if no buildnode is found, instead of just returning false, pollchanges further also checks to see if requiresWorkspaceForPolling returns false. If so it just proceeds to use the master as previously in 1.1.0. I havent completely tested this yet. But my preliminary tests seem to show that it works. I believe that my NPE's are related to AbstractProject invoking pollChanges with launcher and workspace set to null. If I still see these occuring I'll file a NPE issue and try to create another patch. Martin
          Hide
          martinfr martin franklin added a comment -

          if requiresWorkspaceForPolling returns false - never use a build node, so set it to null. This will force p4 to use the master without needed a workspace synced to the file system. Otherwise proceed as before.
          If use this with multiple slaves, dynamic or not, you must use the force sync option.

          Show
          martinfr martin franklin added a comment - if requiresWorkspaceForPolling returns false - never use a build node, so set it to null. This will force p4 to use the master without needed a workspace synced to the file system. Otherwise proceed as before. If use this with multiple slaves, dynamic or not, you must use the force sync option.
          Hide
          rpetti Rob Petti added a comment -

          Setting buildNode to null doesn't actually force it to run on any particular node. It will still use the launcher provided by Jenkins, which could be running on anything.

          Show
          rpetti Rob Petti added a comment - Setting buildNode to null doesn't actually force it to run on any particular node. It will still use the launcher provided by Jenkins, which could be running on anything.
          Hide
          rpetti Rob Petti added a comment -

          This issue is moot now that there is an option to poll only on the master. See JENKINS-9067.

          Show
          rpetti Rob Petti added a comment - This issue is moot now that there is an option to poll only on the master. See JENKINS-9067 .

            People

            • Assignee:
              rpetti Rob Petti
              Reporter:
              paulmoran paulmoran
            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: