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

Problems when running the batch task in parallel with the main job

    XMLWordPrintable

Details

    Description

      I am using the Batch Task plugin to perform releases for my Hudson jobs. But every once in a while, Hudson would start the real job in parallel with the release task, and almost always, this leads to failed builds with very odd behaviors.

      I am using a high frequency for checking CVS changes, about once every 15 minutes (I should change this, but that is a different problem), and when the release task checks in the updated POM into CVS, then this shows up as a code change, and Hudson would start the main job, even though the batch task is not done yet.

      To prevent this issue, I have to disable the main job when I start a batch task to prevent the race condition, and once the release is complete, I enable the job again. The problem is that I often forget this.

      It would be real nice if Hudson or the Batch task can use a form of a lock for the workspace to ensure that only one job/batch can execute at a given time.

      Attachments

        Activity

          chrisgwarp Chris Graham added a comment -

          Thanks!

          Greatly appreciated.

          -Chris

          chrisgwarp Chris Graham added a comment - Thanks! Greatly appreciated. -Chris
          mindless Alan Harder added a comment -

          Sorry for the delay.. I fixed one more issue and just rolled out the release; should be available in a few hours.

          mindless Alan Harder added a comment - Sorry for the delay.. I fixed one more issue and just rolled out the release; should be available in a few hours.
          chrisgwarp Chris Graham added a comment -

          I am now suffering from the same issue. Is there any chance that we can roll out a release that includes this fix?

          -Chris

          chrisgwarp Chris Graham added a comment - I am now suffering from the same issue. Is there any chance that we can roll out a release that includes this fix? -Chris
          mindless Alan Harder added a comment -

          I fixed this, although it uses the same mechanism as SCM polling.. which means it doesn't show as blocked in the build queue, but rather the build is kicked off but then it waits for the workspace lock to be freed up.. sry, best I can do right now.

          mindless Alan Harder added a comment - I fixed this, although it uses the same mechanism as SCM polling.. which means it doesn't show as blocked in the build queue, but rather the build is kicked off but then it waits for the workspace lock to be freed up.. sry, best I can do right now.

          Code changed in hudson
          User: : mindless
          Path:
          trunk/hudson/plugins/batch-task/src/main/java/hudson/plugins/batch_task/BatchRun.java
          http://fisheye4.cenqua.com/changelog/hudson/?cs=25867
          Log:
          [FIXED JENKINS-5285] acquire lock on the workspace while task runs, to prevent
          the owner project or other tasks from using the same ws during the task run.

          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in hudson User: : mindless Path: trunk/hudson/plugins/batch-task/src/main/java/hudson/plugins/batch_task/BatchRun.java http://fisheye4.cenqua.com/changelog/hudson/?cs=25867 Log: [FIXED JENKINS-5285] acquire lock on the workspace while task runs, to prevent the owner project or other tasks from using the same ws during the task run.
          mindless Alan Harder added a comment -

          confirmed.. task won't stop a new build. Nor will one task block another task on the same project from running.

          mindless Alan Harder added a comment - confirmed.. task won't stop a new build. Nor will one task block another task on the same project from running.
          mindless Alan Harder added a comment -

          hm, there is a lock on the workspace and I've definitely tested that a task won't start when a build is running.. haven't tried the reverse though, and that's the case you mention. I'll give it a try.

          mindless Alan Harder added a comment - hm, there is a lock on the workspace and I've definitely tested that a task won't start when a build is running.. haven't tried the reverse though, and that's the case you mention. I'll give it a try.

          People

            mindless Alan Harder
            fshehadeh fshehadeh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: