RFR: 8347173: java/net/DatagramSocket/InterruptibleDatagramSocket.java fails with virtual thread factory [v2]
Jaikiran Pai
jpai at openjdk.org
Tue Jan 14 01:47:43 UTC 2025
On Mon, 13 Jan 2025 18:47:52 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> test/jdk/java/net/DatagramSocket/InterruptibleDatagramSocket.java line 104:
>>
>>> 102: throw new jtreg.SkippedException(
>>> 103: "skipping test execution - main thread is a virtual thread");
>>> 104: }
>>
>> I wonder - would it work instead to replace:
>>
>> test(s, false);
>>
>> with
>>
>> test(s, Thread.currentThread().isVirtual());
>>
>>
>> I am not sure it would work - because the exception that gets thrown could be different... But this would be a way to test both the main-is-virtual and main-is-not-virtual cases.
>
> There was some discussion about this in the JBS issue. BlockingSocketOps.testDatagramSocketReceiveInterrupt tests the scenario for virtual threads so it would be a duplicate test. It doesn't matter, skipping or changing it is fine.
Hello Daniel, My initial idea was to change this test the exact same way as you propose. However, as I note in the JBS issue, the test fails with virtual threads even then:
> The test expects the SocketException that gets thrown in such cases to have a exception cause of ClosedByInterruptException.
> ...
> I don't see that specified in the DatagramSocket.receive(), so it might be that we will have to re-evaluate that test code separately.
I did not want to block any of Leonid's testing work in this area so I decided to skip this test for now. I plan to re-evaluate this test code as a separate task.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23074#discussion_r1914015552
More information about the net-dev
mailing list