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

8276660: Scalability bottleneck in java.security.Provider.getService() #2730

Closed
wants to merge 5 commits into from

Conversation

lutkerd
Copy link
Contributor

@lutkerd lutkerd commented Jul 19, 2024

Backporting JDK-8276660 which also fixes a bug in SecureRandom registration that was exposed during testing of https://github.com/corretto/amazon-corretto-crypto-provider. Currently, if you register a new provider then new SecureRandom doesn't work right away and only after making some other call like Cipher.getInstance() does it return the ACCP provided SecureRandom.

Ran all "java/security/Provider/", "jdk/jfr/event/" and tier1 tests locally on Linux x64 and they passed.

"JDK-8254711: Add java.security.Provider.getService JFR Event" makes changes some of the same functioned but was different in 17u than upstream. To get a cleaner backport I reverted it locally, backported JDK-8276660 and then re-applied 8254711 to get the updated code around the Map changes.

Also backporting the followup fixes:
8292739: Invalid legacy entries may be returned by Provider.getServic…
8279222: Incorrect legacyMap.get in java.security.Provider after JDK-8276660


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • JDK-8292739 needs maintainer approval
  • JDK-8279222 needs maintainer approval
  • JDK-8276660 needs maintainer approval

Issues

  • JDK-8276660: Scalability bottleneck in java.security.Provider.getService() (Enhancement - P3 - Approved)
  • JDK-8292739: Invalid legacy entries may be returned by Provider.getServices() call (Bug - P4 - Approved)
  • JDK-8279222: Incorrect legacyMap.get in java.security.Provider after JDK-8276660 (Bug - P4 - Approved)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk17u-dev.git pull/2730/head:pull/2730
$ git checkout pull/2730

Update a local copy of the PR:
$ git checkout pull/2730
$ git pull https://git.openjdk.org/jdk17u-dev.git pull/2730/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2730

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk17u-dev/pull/2730.diff

Webrev

Link to Webrev Comment

@lutkerd
Copy link
Contributor Author

lutkerd commented Jul 19, 2024

/issue add JDK-8292739
/issue add JDK-8279222

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 19, 2024

👋 Welcome back dlutker! 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 Jul 19, 2024

@lutkerd 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:

8276660: Scalability bottleneck in java.security.Provider.getService()
8292739: Invalid legacy entries may be returned by Provider.getServices() call
8279222: Incorrect legacyMap.get in java.security.Provider after JDK-8276660

Reviewed-by: coffeys

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 15 new commits pushed to the master branch:

  • 9ef505d: 8315651: Stop hiding AIX specific multicast socket errors via NetworkConfiguration (aix)
  • 269bd25: 8307352: AARCH64: Improve itable_stub
  • c7ca5f8: 8334339: Test java/nio/file/attribute/BasicFileAttributeView/CreationTime.java fails on alinux3
  • 933587a: 8280990: [XWayland] XTest emulated mouse click does not bring window to front
  • 234bf86: 8331011: [XWayland] TokenStorage fails under Security Manager
  • 3d39e85: 8320655: awt screencast robot spin and sync issues with native libpipewire api
  • 73b24d0: 8327424: ProblemList serviceability/sa/TestJmapCore.java on all platforms with ZGC
  • e0e2fe6: 8275851: Deproblemlist open/test/jdk/javax/swing/JComponent/6683775/bug6683775.java
  • 6e3dca8: 8280034: ProblemList jdk/jfr/api/consumer/recordingstream/TestOnEvent.java on linux-x64
  • 19aab39: 8193547: Regression automated test '/open/test/jdk/java/awt/Toolkit/DesktopProperties/rfe4758438.java' fails
  • ... and 5 more: https://git.openjdk.org/jdk17u-dev/compare/72de151057ab4aefc53cfcad9745416f60af9068...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 (@shipilev, @coffeys) 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 changed the title Backport 9b747491de01fd011b09668a67113e80c2b7c708 8276660: Scalability bottleneck in java.security.Provider.getService() Jul 19, 2024
@openjdk
Copy link

openjdk bot commented Jul 19, 2024

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added the backport label Jul 19, 2024
@openjdk
Copy link

openjdk bot commented Jul 19, 2024

@lutkerd
Adding additional issue to issue list: 8292739: Invalid legacy entries may be returned by Provider.getServices() call.

@openjdk
Copy link

openjdk bot commented Jul 19, 2024

@lutkerd
Adding additional issue to issue list: 8279222: Incorrect legacyMap.get in java.security.Provider after JDK-8276660.

@lutkerd lutkerd force-pushed the 8276660 branch 3 times, most recently from 60d5a8b to 8561268 Compare July 19, 2024 19:18
Copy link
Member

@shipilev shipilev left a comment

Choose a reason for hiding this comment

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

This looks okay, but I have questions:

Comment on lines 1287 to +1290
if (s == null) {
synchronized (this) {
ensureLegacyParsed();
if (legacyMap != null && !legacyMap.isEmpty()) {
s = legacyMap.get(key);
}
s = legacyMap.get(key);
if (s != null && !s.isValid()) {
legacyMap.remove(key, s);
Copy link
Member

Choose a reason for hiding this comment

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

This hunk seems to be different from the hunk in the original changeset: openjdk/jdk@9b74749#diff-c2847a8d1997d3d28a13354b05d5e21ac6656e7e17f849bc198715099b9b5bd2L1204-R1286 -- and the follow-ups did not change it as well. Does this stack of patches contain some other patch?

Copy link
Contributor Author

@lutkerd lutkerd Jul 22, 2024

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

All right, thanks.

@lutkerd lutkerd marked this pull request as ready for review July 22, 2024 16:30
@lutkerd
Copy link
Contributor Author

lutkerd commented Jul 22, 2024

@coffeys @valeriepeng, can you take a look?

@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 22, 2024
@mlbridge
Copy link

mlbridge bot commented Jul 22, 2024

Webrevs

@coffeys
Copy link
Contributor

coffeys commented Jul 23, 2024

@coffeys @valeriepeng, can you take a look?

Changes look ok to me.

@openjdk
Copy link

openjdk bot commented Jul 23, 2024

⚠️ @lutkerd This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@lutkerd
Copy link
Contributor Author

lutkerd commented Jul 23, 2024

/approval request Backporting JDK-8276660 to fix issue with Provider registration not taking immediate effect. Ran tier1-4 and reproducer of the issue without a problem. Also pulling in followups of JDK-8292739 and JDK-8279222 as to not introduce bugs. This was not clean and required reverting and re-applying JDK-8254711 to get the correct code.

@openjdk
Copy link

openjdk bot commented Jul 23, 2024

@lutkerd
8276660: The approval request has been created successfully.
8292739: The approval request has been created successfully.
8279222: The approval request has been created successfully.

@openjdk openjdk bot added approval ready Pull request is ready to be integrated and removed approval labels Jul 23, 2024
@lutkerd
Copy link
Contributor Author

lutkerd commented Jul 25, 2024

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jul 25, 2024
@openjdk
Copy link

openjdk bot commented Jul 25, 2024

@lutkerd
Your change (at version be1ae3a) is now ready to be sponsored by a Committer.

@Rudometov
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Jul 25, 2024

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

  • 9ef505d: 8315651: Stop hiding AIX specific multicast socket errors via NetworkConfiguration (aix)
  • 269bd25: 8307352: AARCH64: Improve itable_stub
  • c7ca5f8: 8334339: Test java/nio/file/attribute/BasicFileAttributeView/CreationTime.java fails on alinux3
  • 933587a: 8280990: [XWayland] XTest emulated mouse click does not bring window to front
  • 234bf86: 8331011: [XWayland] TokenStorage fails under Security Manager
  • 3d39e85: 8320655: awt screencast robot spin and sync issues with native libpipewire api
  • 73b24d0: 8327424: ProblemList serviceability/sa/TestJmapCore.java on all platforms with ZGC
  • e0e2fe6: 8275851: Deproblemlist open/test/jdk/javax/swing/JComponent/6683775/bug6683775.java
  • 6e3dca8: 8280034: ProblemList jdk/jfr/api/consumer/recordingstream/TestOnEvent.java on linux-x64
  • 19aab39: 8193547: Regression automated test '/open/test/jdk/java/awt/Toolkit/DesktopProperties/rfe4758438.java' fails
  • ... and 5 more: https://git.openjdk.org/jdk17u-dev/compare/72de151057ab4aefc53cfcad9745416f60af9068...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 25, 2024
@openjdk openjdk bot closed this Jul 25, 2024
@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 Jul 25, 2024
@openjdk
Copy link

openjdk bot commented Jul 25, 2024

@Rudometov @lutkerd Pushed as commit fe1a4a8.

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

@lutkerd lutkerd deleted the 8276660 branch July 25, 2024 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants