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

[JMH] Create ephemeral UnixDomainSocketAddress provider with thread-safe close semantics

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 25
    • core-libs

      JDK-8350915 `SocketChannelConnectionSetup` fix to address `NoSuchFileException` thrown when run using multiple threads is incomplete. [~govsrini] reports that he gets `DirectoryNotEmptyException`:

      ```
      java.nio.file.DirectoryNotEmptyException: /tmp/readWriteTest13827267893406153157
      at java.base/sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:269)
      at java.base/sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:110)
      at java.base/java.nio.file.Files.deleteIfExists(Files.java:1084)
      at org.openjdk.bench.java.net.SocketChannelConnectionSetup.afterRun(SocketChannelConnectionSetup.java:100)
      ```

      Using `deleteIfExists()` to delete the *shared* unix socket directory fails due to socket files that are not timely cleaned up by other JMH worker threads.

      JDK-8351601 `UnixSocketChannelReadWrite` fix delivers a better solution by using a dedicated directory per unix socket, and this approach is not prone to these thread safety issues due to its nothing-shared architecture.

      This ticket suggests generalizing the JDK-8351601 `UnixSocketChannelReadWrite` fix and creating a utility (`AutoCloseable`?) unix socket provider class that takes care of releasing its resources in a thread-safe manner.

            vyazici Volkan Yazici
            vyazici Volkan Yazici
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: