RFR: 8245194: Unix domain socket channel implementation [v20]

Michael McMahon michaelm at openjdk.java.net
Wed Oct 14 17:04:53 UTC 2020


On Wed, 14 Oct 2020 13:56:42 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> Michael McMahon has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev
>> excludes the unrelated changes brought in by the merge/rebase. The pull request contains 22 additional commits since
>> the last revision:
>>  - Merge branch 'master' into unixdomainchannels
>>  - - reorganised the channel impls back into SocketChannelImpl and ServerSocketChannelImpl
>>    - removed the new Unix domain socket events and folded the behavior into the existing socket events
>>    - implemented other comments from Alan on Oct 11.
>>  - unixdomainchannels: updates from Chris's review 9 Oct 2020
>>  - unixdomainchannels:
>>    - updated property name
>>    - added JFR unit test
>>  - Merge branch 'master' into unixdomainchannels
>>  - - update after Alan's review on Oct 4
>>    - includes API change required by JDK-8251952
>>    - original CSR for the overall change will be resubmitted with
>>      all api changes consolidated based on this update
>>  - - simplified Copy.gmk to CAT source files directly
>>    - renamed net.properties source files to all be net.properties
>>  - unixdomainchannels: error in the last commit in make/modules/java.base/Copy.gmk
>>  - unixdomainchannels:
>>    (1) rename UnixDomainHelper to UnixDomainSocketsUtil
>>    (2) remove hardcoded /tmp and /var/tmp paths from UnixDomainSocketsUtil
>>    (3) replace (2) with documented system/networking properties
>>    (4) Small update to UnixDomainSocketAddress API
>>    (5) CSR for (3) and (4) submitted at JDK-8253930
>>    (6) Update build to generate net.properties from shared net.properties.common
>>        plus platform specific additions.
>>  - Merge branch 'master' into unixdomainchannels
>>  - ... and 12 more: https://git.openjdk.java.net/jdk/compare/fe5bf7d9...7f677d5a
>
> test/jdk/java/net/UnixDomainSocketAddress/LengthTest.java line 68:
> 
>> 66:                 {new String(new char[100]).replaceAll("\0", "x")},
>> 67:                 {new String(new char[namelen]).replaceAll("\0", "x")},
>> 68:                 {new String(new char[namelen-1]).replaceAll("\0", "x")},
> 
> What's the story with `namelen` ? AFAICS it is always equals to 100? Is it some left over?

No, it is testing a name length that is close to the maximum value. At one point I had a system property that indicates
the actual maximum length on a platform, but that was removed.

> test/jdk/java/nio/channels/unixdomain/Bind.java line 175:
> 
>> 173:         checkNormal(() -> {
>> 174:             client = SocketChannel.open(StandardProtocolFamily.UNIX);
>> 175:             client.bind(null);
> 
> Should there be a test that also verify that you could call:
> client.bind(UNNAMED);
> AFAIU that should be equivalent to `client.bind(null)` ?
> (same remark for the server side)

That would be true for the client side, and I'll add a test for it. But it is not allowed to bind explicitly to the
unnamed address on the server side. It doesn't make sense because an unnamed address means no socket file on the file
system.

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

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


More information about the hotspot-jfr-dev mailing list