Integrated: 8299813: java/nio/channels/DatagramChannel/Disconnect.java fails with jtreg test timeout due to lost datagram
Daniel Fuchs
dfuchs at openjdk.org
Fri Jun 28 11:16:26 UTC 2024
On Wed, 26 Jun 2024 14:15:23 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
> Please find here a simple fix to solve an intermittent failure in java/nio/channels/DatagramChannel/Disconnect.java
>
> On some platform, the underlying system may allow two datagram sockets to bind to the same port, if one of them uses the wildcard address and the other doesn't.
>
> What happens here is that during DC:connect, if the socket is unbound, it will get bound to the wildcard.
> From time to time, this results into binding to the same port that the `server` is using in the test.
> When that happens, datagram sent to the connected server may get misrouted and may not get delivered, and the call server::receive may block forever.
>
> This change does two things:
> 1. explicitly bind the server to the loopback address instead of InetAddress.getLocalHost()
> 2. skip the receive part of the test if the client local address obtained after connecting uses the same port than the server.
>
> This is rare, and skipping the receive part in that case does not invalidate the test.
This pull request has now been integrated.
Changeset: 49eb00da
Author: Daniel Fuchs <dfuchs at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/49eb00da8dc66cff3ca430f06ab21357ee6180ef
Stats: 32 lines in 1 file changed: 19 ins; 0 del; 13 mod
8299813: java/nio/channels/DatagramChannel/Disconnect.java fails with jtreg test timeout due to lost datagram
Reviewed-by: aefimov
-------------
PR: https://git.openjdk.org/jdk/pull/19908
More information about the nio-dev
mailing list