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

flaky tests caused by RestartableJenkinsRule$CopyFileVisitor

XMLWordPrintable

      .RestartableJenkinsRule$CopyFileVisitor is not written in a safe way and it can break a test if a file is currently being written via AtomicFileWriter (or another way if a file is removed between listing directory contents and copying the file).

      e.g. from org.jenkinsci.plugins.workflow.graph.FlowNodeTest.nodeWithNoParentsInBruteForceScanForEnclosingBlock

         0.006 [id=845]	INFO	o.jvnet.hudson.test.JenkinsRule#createWebServer: Running on http://localhost:35733/jenkins/
         0.024 [id=858]	INFO	jenkins.InitReactorRunner$1#onAttained: Started initialization
         0.025 [id=857]	INFO	jenkins.InitReactorRunner$1#onAttained: Listed all plugins
         0.129 [id=857]	INFO	jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
         0.131 [id=860]	INFO	jenkins.InitReactorRunner$1#onAttained: Started all plugins
         0.131 [id=858]	INFO	jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
         0.372 [id=858]	INFO	jenkins.InitReactorRunner$1#onAttained: System config loaded
         0.373 [id=860]	INFO	jenkins.InitReactorRunner$1#onAttained: System config adapted
         0.373 [id=857]	INFO	jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
         0.373 [id=859]	INFO	jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
         0.378 [id=860]	INFO	jenkins.InitReactorRunner$1#onAttained: Completed initialization
      Blocking marker/1
         1.490 [id=845]	INFO	o.j.h.t.RestartableJenkinsRule#simulateAbruptShutdown: Beginning snapshot of JENKINS_HOME so we can simulate abrupt shutdown.  Disk writes MAY be lost if they happen after this.
         1.496 [id=845]	WARNING	o.j.h.t.RestartableJenkinsRule$CopyFileVisitor#visitFileFailed: Error copying file
      java.nio.file.NoSuchFileException: /pct/tmp/work/workflow-api/target/tmp/j h8359519561182624182/jobs/p/builds/1/atomic6485702522622579554tmp
      	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
      	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
      	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
      	at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
      	at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
      	at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
      	at java.nio.file.Files.readAttributes(Files.java:1737)
      	at java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:219)
      	at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
      	at java.nio.file.FileTreeWalker.next(FileTreeWalker.java:372)
      	at java.nio.file.Files.walkFileTree(Files.java:2706)
      	at org.jvnet.hudson.test.RestartableJenkinsRule.simulateAbruptShutdown(RestartableJenkinsRule.java:218)
      	at org.jvnet.hudson.test.RestartableJenkinsRule$4.evaluate(RestartableJenkinsRule.java:259)
      	at org.jvnet.hudson.test.RestartableJenkinsRule$6.evaluate(RestartableJenkinsRule.java:291)
      	at org.jvnet.hudson.test.JenkinsRule$1.evaluate(JenkinsRule.java:601)
      	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:288)
      	at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:282)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.lang.Thread.run(Thread.java:748)
         1.497 [id=845]	INFO	o.j.h.t.RestartableJenkinsRule#simulateAbruptShutdown: Finished snapshot of JENKINS_HOME, any disk writes by Jenkins after this are lost as we will simulate suddenly killing the Jenkins process and switch to the snapshot.
         1.555 [id=845]	INFO	jenkins.model.Jenkins#cleanUp: Stopping Jenkins
         1.569 [id=845]	INFO	jenkins.model.Jenkins#cleanUp: Jenkins stopped
         0.007 [id=880]	INFO	o.jvnet.hudson.test.JenkinsRule#createWebServer: Running on http://localhost:35305/jenkins/
         0.024 [id=892]	INFO	jenkins.InitReactorRunner$1#onAttained: Started initialization
         0.025 [id=894]	INFO	jenkins.InitReactorRunner$1#onAttained: Listed all plugins
         0.113 [id=892]	INFO	jenkins.InitReactorRunner$1#onAttained: Prepared all plugins
         0.114 [id=895]	INFO	jenkins.InitReactorRunner$1#onAttained: Started all plugins
         0.115 [id=895]	INFO	jenkins.InitReactorRunner$1#onAttained: Augmented all extensions
         0.291 [id=895]	INFO	jenkins.InitReactorRunner$1#onAttained: System config loaded
         0.291 [id=892]	INFO	jenkins.InitReactorRunner$1#onAttained: System config adapted
         0.292 [id=892]	INFO	jenkins.InitReactorRunner$1#onAttained: Loaded all jobs
         0.292 [id=893]	INFO	jenkins.InitReactorRunner$1#onAttained: Configuration for all jobs updated
         0.297 [id=894]	INFO	jenkins.InitReactorRunner$1#onAttained: Completed initialization
         0.314 [id=880]	INFO	jenkins.model.Jenkins#cleanUp: Stopping Jenkins
         0.329 [id=880]	INFO	jenkins.model.Jenkins#cleanUp: Jenkins stopped
      

      if a file no longer exists then it should not fail the test case.

            bitwiseman Liam Newman
            teilo James Nord
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: