Skip to content

8259067: bootclasspath append takes out object lock #1935

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

Closed
wants to merge 4 commits into from

Conversation

coleenp
Copy link
Contributor

@coleenp coleenp commented Jan 4, 2021

See CR for details.
I made the classpath append list lock-free. Calling experts in Atomic operations...
Tested with tier1-6.
Thanks,
Coleen


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8259067: bootclasspath append takes out object lock

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/1935/head:pull/1935
$ git checkout pull/1935

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 4, 2021

👋 Welcome back coleenp! 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 rfr Pull request is ready for review label Jan 4, 2021
@openjdk
Copy link

openjdk bot commented Jan 4, 2021

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

  • hotspot
  • serviceability

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 serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org labels Jan 4, 2021
@mlbridge
Copy link

mlbridge bot commented Jan 4, 2021

Webrevs

@coleenp
Copy link
Contributor Author

coleenp commented Jan 4, 2021

For the record, these tests exercise this code:
vmTestbase/nsk/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch007,8,9,10.

Copy link
Member

@lfoltan lfoltan left a comment

Choose a reason for hiding this comment

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

LGTM.
Lois

@openjdk
Copy link

openjdk bot commented Jan 4, 2021

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

8259067: bootclasspath append takes out object lock

Reviewed-by: lfoltan, sspitsyn, iklam, dholmes

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

  • 67c2211: 8259045: Exception message from saproc.dll is garbled on Windows with Japanese locale
  • 28e1f4d: 8247957: remove doclint support for HTML 4
  • 80544e4: 8250564: Remove terminally deprecated constructor in GSSUtil
  • 940b053: 8259232: Bad JNI lookup during printing
  • df721f0: 8259291: Cleanup unnecessary local variables
  • d20d2fa: 8258143: Update --release 16 symbol information for JDK 16 build 30 or later
  • 3be6e06: 8259312: VerifyCACerts.java fails as soneraclass2ca cert will expire in 90 days
  • 722f236: 8259231: Epsilon: improve performance under contention during virtual space expansion
  • f6cb8c5: 8258908: Remove JVM option CleanChunkPoolAsync
  • c0540ff: 8231627: ThreadsListHandleInErrorHandlingTest.java fails in printing all threads
  • ... and 56 more: https://git.openjdk.java.net/jdk/compare/244573509deef62bcf0abd18d4ccc963596b65ec...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.

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

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 4, 2021
@coleenp
Copy link
Contributor Author

coleenp commented Jan 4, 2021

Thanks, Lois!

Copy link
Contributor

@sspitsyn sspitsyn left a comment

Choose a reason for hiding this comment

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

Hi Coleen,

LGTM++

Thanks,
Serguei

@coleenp
Copy link
Contributor Author

coleenp commented Jan 5, 2021

Thanks Serguei. Ioi convinced me offline to simplify and just use a mutex, so I updated the patch to do that. I tested with jdi and jvmti tests and will rerun tier1-3.

@sspitsyn
Copy link
Contributor

sspitsyn commented Jan 5, 2021

Coleen, the function ClassLoader::add_to_boot_append_entries is also called from ClassLoader::update_class_path_entry_list and ClassLoaderExt::append_boot_classpath. It is not clear why the Bootclasspath_lock is not used for sync in these contexts. Could you consider to move this MutexLocker from JvmtiEnv::AddToBootstrapClassLoaderSearch to ClassLoader::add_to_boot_append_entries?

@coleenp
Copy link
Contributor Author

coleenp commented Jan 5, 2021

Thanks Serguei. I was trying to decide whether to move the lock there or add an assert that we are not multi-threaded when the lock isn't held. But it's cleaner to just move the lock there, so I'll do that.

@coleenp
Copy link
Contributor Author

coleenp commented Jan 6, 2021

I reran tier1 and jvmti and jdi tests.

Copy link
Member

@iklam iklam left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@sspitsyn sspitsyn left a comment

Choose a reason for hiding this comment

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

LGTM++

Copy link
Member

@lfoltan lfoltan left a comment

Choose a reason for hiding this comment

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

Changes look good to me.
Lois

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.

Hi Coleen,

Just a quick skim, but I think you need acquire/release for the lock-free path.

Thanks,
David

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.

Addition of release/acquire looks good. Note that we now update _first_append_entry with the same release semantics as ClassPathEntry::set_next - as we should in general.

I'm not 100% clear on which part of these API's can only be called whilst the VM is still single-threaded, but ignoring that, the change to use locked updates with lock-free traversal seems functionally correct. The overall necessity of using locking does depend on the potential for concurrent calls to ClassLoader::add_to_boot_append_entries - something I have not investigated at all.

Thanks,
David

@coleenp
Copy link
Contributor Author

coleenp commented Jan 7, 2021

Thanks for reviewing this, David. The concurrent calls are from JVMTI where the lock was originally, but as suggested by Serguei, for safety, and to avoid tracing through all the callers, I moved the locking to the function where we write the list. It's not a performance critical operation.

@coleenp
Copy link
Contributor Author

coleenp commented Jan 7, 2021

/integrate

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

openjdk bot commented Jan 7, 2021

@coleenp Since your change was applied there have been 69 commits pushed to the master branch:

  • 0e6de4e: 8259339: AllocateUninitializedArray C2 intrinsic fails with void.class input
  • 81c0624: 8259354: Fix race condition in AbstractEventStream.nextThreadName
  • 227f99d: 8233555: [TESTBUG] JRadioButton tests failing on MacoS
  • 67c2211: 8259045: Exception message from saproc.dll is garbled on Windows with Japanese locale
  • 28e1f4d: 8247957: remove doclint support for HTML 4
  • 80544e4: 8250564: Remove terminally deprecated constructor in GSSUtil
  • 940b053: 8259232: Bad JNI lookup during printing
  • df721f0: 8259291: Cleanup unnecessary local variables
  • d20d2fa: 8258143: Update --release 16 symbol information for JDK 16 build 30 or later
  • 3be6e06: 8259312: VerifyCACerts.java fails as soneraclass2ca cert will expire in 90 days
  • ... and 59 more: https://git.openjdk.java.net/jdk/compare/244573509deef62bcf0abd18d4ccc963596b65ec...master

Your commit was automatically rebased without conflicts.

Pushed as commit 1c33847.

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

@coleenp coleenp deleted the classpath-append-lock branch January 7, 2021 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

6 participants