Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8294519

(fs) java/nio/file/Files/CopyProcFile.java fails intermittenly due to unstable /proc/cpuinfo output

    XMLWordPrintable

Details

    • b18

    Description

      The new test from JDK-8293502 fails frequently, usually at high load. Fails reliably in tier2 testing for me:

      $ CONF=linux-x86_64-server-fastdebug make test TEST=java/nio/file/Files/CopyProcFile.java

      ...

      Using source file "/proc/cpuinfo"
      Copied 98894 bytes from /proc/cpuinfo
      config CopyProcFile.createBufferedCopy(): success
      test CopyProcFile.testCopyAndTransfer(CopyProcFile$FHolder@bb8c28f): failure
      java.nio.file.NoSuchFileException: bufferedCopy
      at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
      at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
      at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
      at java.base/sun.nio.fs.UnixFileSystemProvider.isSameFile(UnixFileSystemProvider.java:378)
      at java.base/java.nio.file.Files.isSameFile(Files.java:1538)
      at java.base/java.nio.file.Files.mismatch(Files.java:1590)
      at CopyProcFile.testCopyAndTransfer(CopyProcFile.java:168)


      The real root cause is that test tries to copy from /proc/cpuinfo and check that copied contents are identical. The failure is obscure, because createBufferedCopy masks the initial copy check result by throwing RuntimeException, which the subsequent catch(Exception) block silently captures and deletes the bufferedCopy. Which means "config CopyProcFile.createBufferedCopy(): success" in the output above is actually misleading.

      But /proc/cpuinfo output is not guaranteed to be stable, because it includes CPU frequency. Simple test on my desktop:

      $ while true; do cat /proc/cpuinfo > 1; sleep 1; cat /proc/cpuinfo > 2; diff -uwb 1 2; done
      --- 1 2022-09-28 13:17:50.905173889 +0200
      +++ 2 2022-09-28 13:17:51.929201003 +0200
      @@ -5,7 +5,7 @@
       model name : AMD Ryzen Threadripper 3970X 32-Core Processor
       stepping : 0
       microcode : 0x8301025
      -cpu MHz : 2263.655
      +cpu MHz : 2200.000
       cache size : 512 KB
       physical id : 0
       siblings : 64

      Attachments

        Issue Links

          There are no Sub-Tasks for this issue.

          Activity

            People

              bpb Brian Burkhalter
              shade Aleksey Shipilev
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: