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

(fs) Files.copy fails to copy from /proc on some linux kernel versions

XMLWordPrintable

    • 17
    • b29
    • linux

        This has been initially observed with the test case runtime/os/TestTracePageSizes on a debian testing.
        $ uname -srv
        Linux 5.10.0-6-amd64 #1 SMP Debian 5.10.28-1 (2021-04-09)

        Tests is test/jdk/java/nio are all passing.

        java.nio.file.FileSystemException: /proc/self/smaps -> smaps-copy-31084-0.txt: Invalid argument
        at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
        at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
        at java.base/sun.nio.fs.UnixCopyFile.copyFile(UnixCopyFile.java:256)
        at java.base/sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:603)
        at java.base/sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:258)
        at java.base/java.nio.file.Files.copy(Files.java:1305)
        at TestTracePageSizes.copySmaps(TestTracePageSizes.java:122)
        at TestTracePageSizes.parseSmaps(TestTracePageSizes.java:134)
        at TestTracePageSizes.main(TestTracePageSizes.java:258)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
        at java.base/java.lang.Thread.run(Thread.java:833)

        The man page says:

        EINVAL Descriptor is not valid or locked, or an mmap(2)-like operation is not available for in_fd, or count is negative.

        Probably, an fd pointing to a file in /proc does not support mmap like operations on all kernel versions.

              bpb Brian Burkhalter
              cgo Christoph Göttschkes (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: