8231259: (dc) DatagramChannel::disconnect re-binds socket to the wildcard address (macOS)
Chris Hegarty
chris.hegarty at oracle.com
Tue Nov 19 09:54:43 UTC 2019
> On 18 Nov 2019, at 20:35, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>
> ...
>
> I've put an updated webrev here:
> http://cr.openjdk.java.net/~alanb/8231259/1/webrev/
Generally, this looks good.
A few comments:
1) The new dup2 wrapper around the native call seems more suited to sun.nio.ch.Net, rather than an instance method on DCI. I’d like to be able to use it in white box tests too, to help improve the stability of some tests.
2) Why change disconnect0 from a static method to an instance method? The implementation does not need access to the DCI instance? Same for dup2, as above.
3) Hmm... I’m not sure of the appropriateness of putting an Apple bug number in source code comments? It looks very weird to me. Has similar been done before? ( it should be good enough to have such in JIRA )
>> 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 ).
-Chris.
More information about the nio-dev
mailing list