RFR: 8269481: SctpMultiChannel never releases own file descriptor [v2]

Chris Hegarty chegar at openjdk.java.net
Tue Jun 29 17:02:01 UTC 2021


On Tue, 29 Jun 2021 16:10:44 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Please review this change to the Unix implementations of `sun.nio.ch.sctp.Sctp*ChannelImpl#kill()` to close the socket if `state == ChannelState.UNINITIALIZED`.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8269481: Set state to KILLED *before* closing socket

src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java line 643:

> 641:             if (state == ChannelState.UNINITIALIZED) {
> 642:                 SctpNet.close(fdVal);
> 643:                 state = ChannelState.KILLED;

The change here seems mostly benign - there is no reason why either SctpChannel or SctpServerChannel would find themselves in this state - but it seems ok.

src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java line 377:

> 375:             if (state == ChannelState.UNINITIALIZED) {
> 376:                 SctpNet.close(fdVal);
> 377:                 state = ChannelState.KILLED;

Good catch. It seems that there was a missing state here, but not worth adding at this point.

test/jdk/com/sun/nio/sctp/SctpMultiChannel/CloseDescriptors.java line 71:

> 69:         ProcessBuilder pb = new ProcessBuilder(
> 70:                 "lsof", "-U", "-a", "-p", Long.toString(myPid));
> 71:         Process p = pb.start();

Is this test stable? Do we do similar `losf` in other areas ?

-------------

PR: https://git.openjdk.java.net/jdk/pull/4621


More information about the net-dev mailing list