Uploaded image for project: 'Geode'
  1. Geode
  2. GEODE-9288

DeployedJarTest fails because JavaCompiler.compile() fails to delete temporaryClassesDirectory

    XMLWordPrintableJSON

Details

    Description

      DeployedJarTest.throwsIfFileIsNotValidJarFile() test failed in Windows CI https://concourse.apachegeode-ci.info/teams/main/pipelines/apache-develop-main/jobs/WindowsUnitTestOpenJDK11/builds/225

      The problem did not reproduce on macOS in 1000 runs.

      I notice that the JavaCompiler constructor calls the deprecated Files.createTempDir(). I wonder if there might be a race condition where two test processes (at once) think they own that temp dir and so they can both delete it.

      We might consider replacing that deprecated call with the recommended Files.createTempDirectory() which may be more robust. Looking at the deprecated method and the recommended substitute the latter might have less of a chance of collision due to its use of random suffixes (versus the former's monotonically-increasing ints).

      org.apache.geode.deployment.internal.DeployedJarTest > throwsIfFileIsNotValidJarFile FAILED
          java.io.IOException: Unable to delete directory C:\Users\geode\AppData\Local\Temp\1621373797371-0\classes.
              at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:1212)
              at org.apache.geode.test.compiler.JavaCompiler.compile(JavaCompiler.java:90)
              at org.apache.geode.test.compiler.JarBuilder.buildJarFromClassNames(JarBuilder.java:79)
              at org.apache.geode.deployment.internal.DeployedJarTest.createJarFile(DeployedJarTest.java:82)
              at org.apache.geode.deployment.internal.DeployedJarTest.throwsIfFileIsNotValidJarFile(DeployedJarTest.java:47)
      

      Attachments

        Issue Links

          Activity

            People

              alberto.bustamante.reyes Alberto Bustamante Reyes
              burcham Bill Burcham
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: