Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8302659: Modernize Windows native code for NetworkInterface #12593

Closed
wants to merge 8 commits into from

Conversation

rdicroce
Copy link
Contributor

@rdicroce rdicroce commented Feb 16, 2023

Improves performance and correctness, as discussed on the net-dev mailing list.


Progress

  • Change requires CSR request JDK-8303477 to be approved
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed (2 reviews required, with at least 1 Reviewer, 1 Author)

Issues

  • JDK-8302659: Modernize Windows native code for NetworkInterface
  • JDK-8303477: Modernize Windows native code for NetworkInterface (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/12593/head:pull/12593
$ git checkout pull/12593

Update a local copy of the PR:
$ git checkout pull/12593
$ git pull https://git.openjdk.org/jdk pull/12593/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 12593

View PR using the GUI difftool:
$ git pr show -t 12593

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12593.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 16, 2023

👋 Welcome back rdicroce! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Feb 16, 2023

@rdicroce The following labels will be automatically applied to this pull request:

  • build
  • core-libs
  • net

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added build build-dev@openjdk.org core-libs core-libs-dev@openjdk.org net net-dev@openjdk.org labels Feb 16, 2023
@dfuch
Copy link
Member

dfuch commented Feb 16, 2023

FWIW - there is a perl script located in make/scripts/normalizer.pl that can be run on modified sources to fix up whitespace and CRLF issues when jcheck complains.

@openjdk openjdk bot added the rfr Pull request is ready for review label Feb 16, 2023
@mlbridge
Copy link

mlbridge bot commented Feb 16, 2023

Webrevs

@AlanBateman
Copy link
Contributor

/label remove core-libs

@openjdk openjdk bot removed the core-libs core-libs-dev@openjdk.org label Feb 16, 2023
@openjdk
Copy link

openjdk bot commented Feb 16, 2023

@AlanBateman
The core-libs label was successfully removed.

@AlanBateman
Copy link
Contributor

Would it be possible to re-format the changes to src/java.base/windows/native/libnet/NetworkInterface.c to avoid the overly long lines - some of the new lines are 150-200 characters long so it will make impossible to look at side-by-side diffs in the future.

@rdicroce
Copy link
Contributor Author

Sure. What do you want the max line length to be? 80 chars? 100?

@dfuch
Copy link
Member

dfuch commented Feb 16, 2023

Something between 80 and 100 is usually a good limit. We typically avoid to go above that. So no hard limit at 80 but avoid having lines which are too long. If it displays correctly without wrapping using side diff in webrev / github side diff file view on a regular (for instance, laptop) screen it's a good sign.

Copy link
Member

@magicus magicus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build changes look fine.

/reviewers 2

@openjdk
Copy link

openjdk bot commented Feb 16, 2023

@rdicroce This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8302659: Modernize Windows native code for NetworkInterface

Reviewed-by: ihse, djelinski, alanb, michaelm

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 505 new commits pushed to the master branch:

  • 01e6920: 8298935: fix independence bug in create_pack logic in SuperWord::find_adjacent_refs
  • 3d77e21: 8301308: Remove version conditionalization for gcc/clang PRAGMA_DIAG_PUSH/POP
  • e3777b0: 8270865: Print process ID with -Xlog:os
  • 349139b: 8304030: Configure call fails on AIX when using --with-gtest option.
  • 714b5f0: 8294962: Convert java.base/jdk.internal.module package to use the Classfile API to modify and write module-info.class
  • 065d3e0: 8304171: Fix layout of JCov instrumented bundle on Mac OS
  • cd41c69: 8303705: Field sleeper.started should be volatile JdbLockTestTarg.java
  • f5c8b68: 8301998: Update HarfBuzz to 7.0.1
  • 617c15f: 8304172: ProblemList serviceability/sa/UniqueVtableTest.java
  • f81e1de: 8303882: Refactor some iterators in jdk.compiler
  • ... and 495 more: https://git.openjdk.org/jdk/compare/ecf21a9a24d067725fda916ab197b5711c56a1d7...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@magicus, @djelinski, @AlanBateman, @Michael-Mc-Mahon) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Feb 16, 2023
@openjdk
Copy link

openjdk bot commented Feb 16, 2023

@magicus
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 2 (with at least 1 Reviewer, 1 Author).

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Feb 16, 2023
@rdicroce
Copy link
Contributor Author

Maximum line length reduced to 80-ish characters.

Copy link
Member

@djelinski djelinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the changes look good. A few comments below.

src/java.base/windows/native/libnet/NetworkInterface.c Outdated Show resolved Hide resolved
src/java.base/windows/native/libnet/NetworkInterface.c Outdated Show resolved Hide resolved
src/java.base/windows/native/libnet/NetworkInterface.c Outdated Show resolved Hide resolved
src/java.base/windows/native/libnet/NetworkInterface.c Outdated Show resolved Hide resolved
src/java.base/windows/native/libnet/NetworkInterface.c Outdated Show resolved Hide resolved
src/java.base/windows/native/libnet/NetworkInterface.c Outdated Show resolved Hide resolved
src/java.base/windows/native/libnet/NetworkInterface.c Outdated Show resolved Hide resolved
@msheppar
Copy link

what versions of Windows has this been tested on ? Just wondering if the deletion of the old dual stack winXP based code could have on the older windows OS platforms?
afaik current set of supported windows OS platforms, from the ATR list, are :
windows server 2019,
windows server 2022,
windows server 2016,
windows 10,
windows 11,
windows 8,
windows server2012,
windows server 2012R2

some of these may be retired for LTS JDK21, but for the moment they are in the mix.
We'll need to schedule test runs for all these.

Also we will have to arrange some IPv6 only test runs for this prior to any integration -- that takes a bit of time to arrange the resources to be setup and to schedule the runs.

@rdicroce
Copy link
Contributor Author

@msheppar I tested this on Windows 10 and 11. I don't have access to any older systems. But I tried to be careful about which APIs I used. I'm pretty sure I checked the MS docs for all of them, and they all exist since Vista/Server 2008. So this should work on all the versions you listed.

@msheppar
Copy link

I don't think the NetworkInterface.h file should be dropped.
It is preferrable that typedef and struct decalarations remain in a header file rather than being merged into .c file.

@AlanBateman
Copy link
Contributor

Overall I think this is a very contribution. It's good to modernize this code and remove the cruft that dates from before many of the new APIs were added.

I suspect we will need a release document any behaviour changes that may be observed when upgrading the JDK. In particular, the network interface names will look different. The synthesized names were names like "lo" and "eth0" whereas the new names come from Windows (names like "lookup_0" and "ethernet_0"). I haven't found tools that show the names that ConvertInterfaceLuidToNameW returns but if there are then the RN could mention it. On other platforms, it would be was easy for configuration to name the interface to be used for multicasting, it doesn't seem easy to do the same on Windows and application might have to resort to configuration by IP address.

I'm not too concerned that interfaces without IP addresses are enumerated. They aren't useful for multicasting applications but maybe they are useful for informational purposes, e.g. programs that collect system environment. I'm also not too concern about the ordering of the IP addresses. I'll defer to @djelinski on whether some JDK tests or test infra needs to be updated in advance to ensure that tests that choose interfaces will continue to work.

@djelinski
Copy link
Member

Ok then, let's keep the filter interfaces as they are; we can always revisit the issue later if there's demand.
I'm already working on updating the JCK tests.

@rdicroce
Copy link
Contributor Author

rdicroce commented Mar 1, 2023

I've updated the PR to address all of the various comments.

@AlanBateman Regarding tools that return the new interface names, I'm not aware of any either. But it's not too hard to hack together a PowerShell script to call if_indextoname which does exactly what the name implies.

Copy link
Member

@djelinski djelinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Network interface changes LGTM now. I'm not sure about the change to ResolverConfiguration, see below.

@djelinski
Copy link
Member

Thanks for that!
I'm still running one last round of tests and will approve this if there are no new failures.

I'll start working on a CSR and a release note.

/csr needed

@openjdk
Copy link

openjdk bot commented Mar 1, 2023

@djelinski only the pull request author and Reviewers are allowed to use the csr command.

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Mar 1, 2023
@openjdk openjdk bot added ready Pull request is ready to be integrated and removed csr Pull request needs approved CSR before integration labels Mar 13, 2023
@djelinski
Copy link
Member

CSR approved, release note ready. I think we're good to go. @rdicroce you can integrate the changes now.

@rdicroce
Copy link
Contributor Author

Thanks @djelinski!

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Mar 14, 2023
@openjdk
Copy link

openjdk bot commented Mar 14, 2023

@rdicroce
Your change (at version 6a58575) is now ready to be sponsored by a Committer.

@Michael-Mc-Mahon
Copy link
Member

I think the change looks good. We might need to put some more work into examining all details of behavior changes. For example, I noticed that previously the InetAddresses for each interface are returned IPv4 first, whereas now they are returned IPv6 first (on Windows 10 at least).

@djelinski
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Mar 15, 2023

Going to push as commit 35a2969.
Since your change was applied there have been 505 commits pushed to the master branch:

  • 01e6920: 8298935: fix independence bug in create_pack logic in SuperWord::find_adjacent_refs
  • 3d77e21: 8301308: Remove version conditionalization for gcc/clang PRAGMA_DIAG_PUSH/POP
  • e3777b0: 8270865: Print process ID with -Xlog:os
  • 349139b: 8304030: Configure call fails on AIX when using --with-gtest option.
  • 714b5f0: 8294962: Convert java.base/jdk.internal.module package to use the Classfile API to modify and write module-info.class
  • 065d3e0: 8304171: Fix layout of JCov instrumented bundle on Mac OS
  • cd41c69: 8303705: Field sleeper.started should be volatile JdbLockTestTarg.java
  • f5c8b68: 8301998: Update HarfBuzz to 7.0.1
  • 617c15f: 8304172: ProblemList serviceability/sa/UniqueVtableTest.java
  • f81e1de: 8303882: Refactor some iterators in jdk.compiler
  • ... and 495 more: https://git.openjdk.org/jdk/compare/ecf21a9a24d067725fda916ab197b5711c56a1d7...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Mar 15, 2023
@openjdk openjdk bot closed this Mar 15, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Mar 15, 2023
@openjdk
Copy link

openjdk bot commented Mar 15, 2023

@djelinski @rdicroce Pushed as commit 35a2969.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build-dev@openjdk.org integrated Pull request has been integrated net net-dev@openjdk.org
7 participants