On Sun, 15 Nov 2026 08:06:49 GMT, Alan Bateman <[email protected]> wrote:
>> The "blocked in write" tests in BlockingSocketOps and BlockingChannelOps are >> problematic as the underlying non-blocking socket may be polled as writable >> several times before the virtual thread writer blocks indefinitely. The >> tests were updated recently to additionally test the blocked thread's >> parkBlocker, which makes it harder to test when it wakes up several times. >> >> The tests are simplified to avoid special casing the writing case. The >> runAfterParkedAsync method in both tests now polls the thread until it parks >> and the parkBlocker is set. BlockingChannelOps tests the expected >> parkBlocker whereas BlockingSocketOps just tests for a non-null parkBlocker. >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > Alan Bateman has updated the pull request incrementally with one additional > commit since the last revision: > > Fixed typos in test comments LGTM. Dropped some minor remarks/questions, but it can be integrated in its current form. I'd make sure, in addition to Tiers 1-2, @dfuch's reproducer (i.e., `test/jdk:jdk_net` with 50 repetitions) passes on all supported platforms. test/jdk/java/net/vthread/BlockingSocketOps.java line 702: > 700: * @return the thread that executes the task > 701: */ > 702: private static Thread runAfterParkedAsync(ThrowingRunnable task) { Currently, `awaitParked(target); task.run()` failures are only communicated in the logs; they don't affect the test execution. You may consider returning a `CompletableFuture<Void>`, passing `e` at line 764 to it, and always finishing a `@Test` block with a `future.get()` to ensure no `task.run()` failures are discarded. test/jdk/java/net/vthread/BlockingSocketOps.java line 721: > 719: */ > 720: private static void awaitParked(Thread target) throws > InterruptedException { > 721: while (!isParked(target) || LockSupport.getBlocker(target) == > null) { Curious: Why doesn't `isParked()` have a `LockSupport.getBlocker(target) != null` check, but `awaitParked()` does? test/jdk/java/net/vthread/BlockingSocketOps.java line 757: > 755: } > 756: } > 757: } It is good to see this nudge is gone. ------------- Marked as reviewed by vyazici (Reviewer). PR Review: https://git.openjdk.org/jdk/pull/33907#pullrequestreview-5917077087 PR Review Comment: https://git.openjdk.org/jdk/pull/33907#discussion_r4583547492 PR Review Comment: https://git.openjdk.org/jdk/pull/33907#discussion_r4583507011 PR Review Comment: https://git.openjdk.org/jdk/pull/33907#discussion_r4583565210
