8231259: (dc) DatagramChannel::disconnect re-binds socket to the wildcard address (macOS)

Daniel Fuchs daniel.fuchs at oracle.com
Tue Nov 19 10:44:13 UTC 2019


Hi Chris,

On 19/11/2019 09:54, Chris Hegarty wrote:
>>> In case repairSocket() later fails. Although we already specified
>>> that "the socket is an unspecified state", it would leave
>>> the socket is in an unspecified state closer to what it was
>>> before the fix.
>> That is a good point, there should be a try-finally around the repair so that the localAddress is set even when it fails.
> 4) Given the potential for failure at any point during “repairing”, it is not just "the channel's socket” that "may be left in an unspecified state”, but the channel itself ( it may be blocking or non-blocking, bound or not-bound, some options set some not, etc ).

How so? Unless I miss something these all pertain to the
underlying channel's socket - not to the channel itself.

And the recommendation to close the channel if disconnect fails
still holds.

best regards,

-- daniel


More information about the nio-dev mailing list