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

8254566: Clarify the spec of ClassLoader::getClassLoadingLock for non-parallel capable loader #14720

Closed
wants to merge 3 commits into from

Conversation

mlchung
Copy link
Member

@mlchung mlchung commented Jun 29, 2023

The spec of ClassLoader::getClassLoadingLock is unclear that this method is intended for parallel-capable class loader implementations to provide an alternate implementation. For non-parallel-capable class loaders, this method should return this ClassLoader object. The javadoc uses "the default implementation" which could be interpreted that non-parallel-capable class loaders can also override this implementation, which is not the intent. See https://openjdk.org/groups/core-libs/ClassLoaderProposal.html.


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
  • Change requires CSR request JDK-8311128 to be approved

Issues

  • JDK-8254566: Clarify the spec of ClassLoader::getClassLoadingLock for non-parallel capable loader (Bug - P4)
  • JDK-8311128: Clarify the spec of ClassLoader::getClassLoadingLock for non-parallel capable loader (CSR)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 14720

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 29, 2023

👋 Welcome back mchung! 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 openjdk bot added the csr Pull request needs approved CSR before integration label Jun 29, 2023
@openjdk
Copy link

openjdk bot commented Jun 29, 2023

@mlchung The following label will be automatically applied to this pull request:

  • core-libs

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

@openjdk openjdk bot added core-libs core-libs-dev@openjdk.org rfr Pull request is ready for review labels Jun 29, 2023
@mlbridge
Copy link

mlbridge bot commented Jun 29, 2023

Webrevs

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

Looks good. One change requested on terminology.

Thanks

*
* @apiNote
* This method allows parallel capable class loaders to implement
* finer-grained locking scheme such that multiple threads may load classes
Copy link
Member

Choose a reason for hiding this comment

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

s/scheme/schemes/

* This method allows parallel capable class loaders to implement
* finer-grained locking scheme such that multiple threads may load classes
* concurrently without deadlocks. For non-parallel-capable class loaders,
* the {@code ClassLoader} object is held during the class loading operations.
Copy link
Member

Choose a reason for hiding this comment

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

s/is held/is synchronized on/ - as that is the terminology loadClass uses.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated per your suggestion.

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@openjdk
Copy link

openjdk bot commented Jun 30, 2023

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

8254566: Clarify the spec of ClassLoader::getClassLoadingLock for non-parallel capable loader

Reviewed-by: dholmes, darcy

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

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.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed csr Pull request needs approved CSR before integration labels Jun 30, 2023
@mlchung
Copy link
Member Author

mlchung commented Jul 3, 2023

/integrate

@openjdk
Copy link

openjdk bot commented Jul 3, 2023

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

  • f393975: 8310743: assert(reserved_rgn != nullptr) failed: Add committed region, No reserved region found
  • ba974d5: 8310661: JFR: Replace JVM.getJVM() with JVM
  • 496f94b: 8311086: Remove jtreg/gc/startup_warnings
  • 9d2e0b2: 8307934: JRobot.moveMouseTo must access component on EDT
  • 87c79c0: 8309302: java/net/Socket/Timeouts.java fails with AssertionError on test temporal post condition
  • 8e0ca8e: 8310331: JitTester: Exclude java.lang.Math.random
  • 055b4b4: 8310948: Fix ignored-qualifiers warning in Hotspot
  • 2c29705: 8309660: C2: failed: XMM register should be 0-15 (UseKNLSetting and ConvF2HF)
  • 52ee570: 8309209: C2 failed "assert(_stack_guard_state == stack_guard_reserved_disabled) failed: inconsistent state"
  • faf1b82: 8310656: RISC-V: __builtin___clear_cache can fail silently.
  • ... and 19 more: https://git.openjdk.org/jdk/compare/11fd34e196b29d2f2fd276c36f59a3c3b3ce7280...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jul 3, 2023

@mlchung Pushed as commit b9198f9.

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

* finer-grained locking schemes such that multiple threads may load classes
* concurrently without deadlocks. For non-parallel-capable class loaders,
* the {@code ClassLoader} object is synchronized on during the class loading
* operations. Class loaders with non-hierarchical delegation should be
Copy link
Contributor

Choose a reason for hiding this comment

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

At some point we might want to re-visit the use of "non-hierarchical" (and "hierarchical" in the class description) as deadlocks are also possible with hierarchical delegation when mixing parent-first and child-first delegation. It could be that the the API note provides a strong recommendation the class loader be parallel capable when it is anything other than single parent with parent delegation.

@mlchung mlchung deleted the JDK-8254566 branch August 2, 2023 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
4 participants