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

Not setting 'Keep past HTML reports' on a job that runs concurrently can cause java.io.IOException: Unable to delete <file>

      version 1.2

      When two builds attempt to archive the same output at the project level at the same time, the following output can be seen:

      [htmlpublisher] Archiving HTML reports...
      [htmlpublisher] Archiving at PROJECT level <source> to <destination>
      FATAL: HTML Publisher failure
      java.io.IOException: Unable to delete <destination>
      at hudson.Util.deleteFile(Util.java:239)
      at hudson.Util.deleteRecursive(Util.java:289)
      at hudson.Util.deleteContentsRecursive(Util.java:200)
      at hudson.Util.deleteRecursive(Util.java:280)
      at hudson.FilePath$11.invoke(FilePath.java:920)
      at hudson.FilePath$11.invoke(FilePath.java:918)
      at hudson.FilePath.act(FilePath.java:852)
      at hudson.FilePath.act(FilePath.java:834)
      at hudson.FilePath.deleteRecursive(FilePath.java:918)
      at htmlpublisher.HtmlPublisher.perform(HtmlPublisher.java:209)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:718)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:693)
      at hudson.model.Build$BuildExecution.post2(Build.java:183)
      at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:640)
      at hudson.model.Run.execute(Run.java:1527)
      at hudson.model.Run.run(Run.java:1448)
      at com.tikal.jenkins.plugins.multijob.MultiJobBuild.run(MultiJobBuild.java:60)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:237)

      This is likely due to the setting of "BuildStepMonitor.NONE" meaning that each build does not wait for the previous one to complete before processing it's post-build steps. I believe this is correct when archiving is at the BUILD level as there is no clash of file access but for PROJECT level this should be changed to BuildStepMonitor.BUILD (if I have understood the javadoc's correctly)

        1. build1.txt
          10 kB
        2. build2.txt
          0.4 kB

          [JENKINS-23061] Not setting 'Keep past HTML reports' on a job that runs concurrently can cause java.io.IOException: Unable to delete <file>

          mcrooney added a comment -

          Thanks for your time and investigation! I'm not familiar with those BuidStepMonitor options, would you be willing to create a pull request at https://github.com/jenkinsci/htmlpublisher-plugin that uses the appropriate NONE or BUILD based on the configuration of HTML Publisher?

          mcrooney added a comment - Thanks for your time and investigation! I'm not familiar with those BuidStepMonitor options, would you be willing to create a pull request at https://github.com/jenkinsci/htmlpublisher-plugin that uses the appropriate NONE or BUILD based on the configuration of HTML Publisher?

          I have the same problem, when the same job is ran concurrently on different slaves.

          At the end of the job, if two of them try to archive the generated HTML report, one of them fail because of this error.

          We are using this plugin to publish HTML reports containing screenshots of integration tests, that are concurrently ran on multiple machines.

          If I check the option to keep old reports, all HTML files seem to be merged in a GIANT file (becoming unreadable). If I uncheck the option, it randomly fails some builds because of this error.

          Guillaume Gautreau added a comment - I have the same problem, when the same job is ran concurrently on different slaves. At the end of the job, if two of them try to archive the generated HTML report, one of them fail because of this error. We are using this plugin to publish HTML reports containing screenshots of integration tests, that are concurrently ran on multiple machines. If I check the option to keep old reports, all HTML files seem to be merged in a GIANT file (becoming unreadable). If I uncheck the option, it randomly fails some builds because of this error.

          Hi - this issue has been around and not touched for a year or more. In an effort to try and focus on issues which are still present, I am resolving these issues for now.

          If you feel that the issue is still present, please feel free to re-open / comment. I'll be closing off any issues that haven't had any re-opening or comments by the end of the month.

          Thanks for reporting these issues - hopefully you are still using HTML Publisher and its working for you but, if not, let me know so that I can focus on issues that are causing you problems today

          Richard Bywater added a comment - Hi - this issue has been around and not touched for a year or more. In an effort to try and focus on issues which are still present, I am resolving these issues for now. If you feel that the issue is still present, please feel free to re-open / comment. I'll be closing off any issues that haven't had any re-opening or comments by the end of the month. Thanks for reporting these issues - hopefully you are still using HTML Publisher and its working for you but, if not, let me know so that I can focus on issues that are causing you problems today

          Geoff Dunn added a comment -

          It's still a valid issue however it's very low priority so I'm not re-opening. I have a project where two jobs typically get triggered when a Pull Request is created. One for the branch and one for the Pull Request. That can cause one to fail due to this lockup. I've only seen it happen twice (so it's probably under 1% chance) and stopping that double build happening has meant it hasn't happened since.

          Geoff Dunn added a comment - It's still a valid issue however it's very low priority so I'm not re-opening. I have a project where two jobs typically get triggered when a Pull Request is created. One for the branch and one for the Pull Request. That can cause one to fail due to this lockup. I've only seen it happen twice (so it's probably under 1% chance) and stopping that double build happening has meant it hasn't happened since.

          Peter Bauer added a comment -

          Happened a few times here with two builds of the same branch started close to each other. Please find attached the log outputs of the failing build (all stages are green though) build1.txtand the nearly simultaneous one: build2.txt

          Peter Bauer added a comment - Happened a few times here with two builds of the same branch started close to each other. Please find attached the log outputs of the failing build (all stages are green though) build1.txt and the nearly simultaneous one: build2.txt

            r2b2_nz Richard Bywater
            lrobertson39 Luke Robertson
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: