RFR: 8294375: test/jdk/java/nio/channels/vthread/BlockingChannelOps.java is slow

Alan Bateman alanb at openjdk.org
Mon Sep 26 16:13:02 UTC 2022


BlockingChannelOps.java and BlockingSocketOps.java test virtual threads doing blocking I/O on channels and java.net sockets.

BlockingChannelOps has 32 tests at this time and takes nearly 120s to run due to several tests that sleep to improve the chances that threads are are blocked. These sleeps can be replaced with a poll of the thread state so the test runs in 3-4s. BlockingSocketOps has be changed to do the same time.

In passing, I updated the tests in BlockingSocketOps that bound a ServerSocket address to the wildcard address so they bind to the loopback address instead. This helps reduce potential interference in CI environments. I also put a workaround into BlockingChannelOps for macOS where the kernel appears to increase the amount of bytes that can be buffered in the socket sender buffer, it's otherwise too hard to test that socket writes block on that platform.

-------------

Commit messages:
 - Initial commit

Changes: https://git.openjdk.org/jdk/pull/10427/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10427&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8294375
  Stats: 602 lines in 2 files changed: 125 ins; 311 del; 166 mod
  Patch: https://git.openjdk.org/jdk/pull/10427.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10427/head:pull/10427

PR: https://git.openjdk.org/jdk/pull/10427


More information about the nio-dev mailing list