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

8253262: Allocate in DumpRegion is not thread safe #216

Closed
wants to merge 1 commit into from
Closed

8253262: Allocate in DumpRegion is not thread safe #216

wants to merge 1 commit into from

Conversation

@yminqi
Copy link
Contributor

@yminqi yminqi commented Sep 17, 2020

At CDS dump, the symbols are allocated from _dump_region (DumpRegion) which is global, and not thread safe when executed in JavaThread. Add a lock DumpRegoin_lock to guard symbol allocation from it.

Tests: tier1-4


Progress

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

Issue

  • JDK-8253262: Allocate in DumpRegion is not thread safe

Reviewers

Download

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

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Sep 17, 2020

👋 Welcome back minqi! 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.

Loading

@openjdk openjdk bot added the rfr label Sep 17, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Sep 17, 2020

@yminqi The following label will be automatically applied to this pull request: hotspot.

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 (add|remove) "label" command.

Loading

@openjdk openjdk bot added the hotspot label Sep 17, 2020
@mlbridge
Copy link

@mlbridge mlbridge bot commented Sep 17, 2020

Webrevs

Loading

@dholmes-ora
Copy link
Member

@dholmes-ora dholmes-ora commented Sep 17, 2020

This seems okay but isn't dumping done at a safepoint?

Loading

@yminqi
Copy link
Contributor Author

@yminqi yminqi commented Sep 17, 2020

This seems okay but isn't dumping done at a safepoint?

There is case the code is executed in other JavaThread (seen in Finalizer thread) other than the JavaThread which does loading classes and creating symbols. That is before the dump starts. The word 'at dump' seems misleading.

Loading

Copy link
Member

@calvinccheung calvinccheung left a comment

Looks good.

Loading

@openjdk
Copy link

@openjdk openjdk bot commented Sep 17, 2020

@yminqi This change now passes all automated pre-integration checks. In addition to the automated checks, the change must also fulfill all project specific requirements

After integration, the commit message will be:

8253262: Allocate in DumpRegion is not thread safe

Reviewed-by: ccheung
  • If you would like to add a summary, use the /summary command.
  • To credit additional contributors, use the /contributor command.
  • To add additional solved issues, use the /issue command.

Since the source branch of this PR was last updated there have been 39 commits pushed to the master branch:

  • 3570f5a: 8252041: G1: Fix incorrect uses of HeapRegionManager::max_length
  • 24765e4: 8253285: Some java/util/StringJoiner tests do not explicitly specify required -XX:+CompactStrings
  • 81e2cf8: 8251397: NPE on ClassValue.ClassValueMap.cacheArray
  • cca3a26: 8252996: Thread safety problem in java.net.ProxySelector
  • a4c6a99: 8252593: [TESTBUG] serviceability/jvmti/GetLocalVariable/GetLocalWithoutSuspendTest.java failed with JVMTI_ERROR_INVALID_SLOT
  • a67f890: 8253050: jfr disassemble command processes --max-chunks incorrectly
  • f972155: 8252196: ZGC: TestUncommit.java fails due to "Exception: Uncommitted too fast" again(2)
  • a9993f9: 8253275: Remove unused methods after CMS removal
  • 4ac6934: 8253232: G1Analytics::compute_pause_time_ratios() uses wrong pause times in calculation
  • 53a4ef2: 8202473: A type variable with multiple bounds does not correctly place type annotation
  • ... and 29 more: https://git.openjdk.java.net/jdk/compare/74851c507bed9eb2e1e0b0eac3b53a74decb2588...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid automatic rebasing, please merge master into your branch, and then specify the current head hash when integrating, like this: /integrate 3570f5a924876be000891bc5447742812d6b0262.

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

Loading

@openjdk openjdk bot added the ready label Sep 17, 2020
@yminqi
Copy link
Contributor Author

@yminqi yminqi commented Sep 17, 2020

/integrate

Loading

@openjdk openjdk bot closed this Sep 17, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Sep 17, 2020
@openjdk
Copy link

@openjdk openjdk bot commented Sep 17, 2020

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

  • 3570f5a: 8252041: G1: Fix incorrect uses of HeapRegionManager::max_length
  • 24765e4: 8253285: Some java/util/StringJoiner tests do not explicitly specify required -XX:+CompactStrings
  • 81e2cf8: 8251397: NPE on ClassValue.ClassValueMap.cacheArray
  • cca3a26: 8252996: Thread safety problem in java.net.ProxySelector
  • a4c6a99: 8252593: [TESTBUG] serviceability/jvmti/GetLocalVariable/GetLocalWithoutSuspendTest.java failed with JVMTI_ERROR_INVALID_SLOT
  • a67f890: 8253050: jfr disassemble command processes --max-chunks incorrectly
  • f972155: 8252196: ZGC: TestUncommit.java fails due to "Exception: Uncommitted too fast" again(2)
  • a9993f9: 8253275: Remove unused methods after CMS removal
  • 4ac6934: 8253232: G1Analytics::compute_pause_time_ratios() uses wrong pause times in calculation
  • 53a4ef2: 8202473: A type variable with multiple bounds does not correctly place type annotation
  • ... and 29 more: https://git.openjdk.java.net/jdk/compare/74851c507bed9eb2e1e0b0eac3b53a74decb2588...master

Your commit was automatically rebased without conflicts.

Pushed as commit 12dfe1c.

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

Loading

@yminqi yminqi deleted the jdk-8253262 branch Sep 17, 2020
@dholmes-ora
Copy link
Member

@dholmes-ora dholmes-ora commented Sep 21, 2020

It seems to me that the need for locking should be an internal implementation detail of MetaspaceShared::symbol_space_alloc, rather than Symbol operator new.

Loading

@yminqi
Copy link
Contributor Author

@yminqi yminqi commented Sep 21, 2020

It seems to me that the need for locking should be an internal implementation detail of MetaspaceShared::symbol_space_alloc, rather than Symbol operator new.

I pushed before saw your above comment. The reason for current place is because the following code:
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/oops/symbol.cpp#L75
DEBUG_ONLY(static void* last = 0);
void* p = (void*)MetaspaceShared::symbol_space_alloc(size(len)*wordSize);
assert(p > last, "must increase monotonically");
DEBUG_ONLY(last = p);
return p;
this 'last' is not thread safe either.

Loading

@dholmes-ora
Copy link
Member

@dholmes-ora dholmes-ora commented Sep 22, 2020

My comment was made after the integration so no issue there.

But I think the monotonicity check also belongs inside MetaspaceShared::symbol_space_alloc

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants