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

8313081: MonitoringSupport_lock should be unconditionally initialized after 8304074 #15028

Closed
wants to merge 2 commits into from

Conversation

phohensee
Copy link
Member

@phohensee phohensee commented Jul 25, 2023

MonitoringSupport_lock is initialized only when UseG1GC is true, but JDK-8304074 uses it to implement getTotalThreadAllocatedBytes, which is available for all garbage collectors. While the current code sets UseG1GC regardless of which collector is specified, see FLAG_SET_ERGO_IF_DEFAULT(UseG1GC, true) in gcConfig.cpp, if G1 isn't included in the Hotspot build or Hotspot is not running on a server class machine (unlikely these days), the lock will not be initialized. The lock's initialization should be unconditional.

I updated ThreadAllocatedMemory.java to run the test using both G1 and Serial collectors.


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

Issue

  • JDK-8313081: MonitoringSupport_lock should be unconditionally initialized after 8304074 (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 15028

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 25, 2023

👋 Welcome back phh! 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 Jul 25, 2023
@openjdk
Copy link

openjdk bot commented Jul 25, 2023

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

  • hotspot-runtime
  • jmx
  • 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-runtime hotspot-runtime-dev@openjdk.org jmx jmx-dev@openjdk.org labels Jul 25, 2023
@mlbridge
Copy link

mlbridge bot commented Jul 25, 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.

Thanks.

@openjdk
Copy link

openjdk bot commented Jul 26, 2023

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

8313081: MonitoringSupport_lock should be unconditionally initialized after 8304074

Reviewed-by: dholmes, sspitsyn, shade

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

  • 830413f: 8313087: DerValue::toString should output a hex view of the values in byte array
  • 7412193: 4800398: (ch spec) Clarify Channels.newChannel(InputStream) spec
  • e7726fb: 8313155: Problem list some JUnit-based tests in test/jdk/java/lang/invoke
  • 02a0473: 8312445: Array types in annotation elements show square brackets twice
  • c22cadf: 8312526: Test dk/jfr/event/oldobject/TestHeapDeep.java failed: Could not find ChainNode
  • cc2a75e: 8312619: Strange error message when switching over long
  • 1f81e5b: 8312229: Crash involving yield, switch and anonymous classes
  • e9daf4a: 8312916: Remove remaining usages of -Xdebug from test/hotspot/jtreg
  • 117f42d: 8312625: Test serviceability/dcmd/vm/TrimLibcHeapTest.java failed: RSS use increased
  • 2d05d35: 8312979: Fix assembler_aarch64.hpp after JDK-8311847

Please see this link for an up-to-date comparison between the source branch of this pull request and 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 the ready Pull request is ready to be integrated label Jul 26, 2023
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.

Looks good.
Thanks,
Serguei

@shipilev
Copy link
Member

So... this does not visibly break right now, because the MutexLocker in jmm_GetTotalThreadAllocatedMemory silently accepts nullptr as the lock? I think we should assert(MonitoringSupport_lock != nullptr) there. This should also turn the new UseSerialGC test config into proper regression test: the test should fail on that assert without this patch.

@phohensee
Copy link
Member Author

windows-aarch64 pre-submit build failure is due to an unrelated aarch64-specific issue.

@phohensee
Copy link
Member Author

phohensee commented Jul 26, 2023

Thanks for the quick reviews!

Aleksey, no, it doesn't break now because (1) we don't appear to test on non-server class machines, and (2) FLAG_SET_ERGO_IF_DEFAULT sets UseG1GC unconditionally regardless of which GC is specified on the command line because it (UseG1GC) hasn't also been specified on the command line. So, the assert would have no effect unless run on a non-server class machine. I've added the assert though.

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.

Looks good! I reverted the mutexLocker.cpp hunk locally, and the test fails on assert, as expected.

@phohensee
Copy link
Member Author

Thanks, Aleksey. Will push once pre-submit tests finish.

@phohensee
Copy link
Member Author

phohensee commented Jul 26, 2023

I filed JDK-8313200 to track the windows-aarch64 build issue.

But, it's a dup of JDK-8312979, so now closed.

@shipilev
Copy link
Member

...and I filed JDK-8313202 to deal with MutexLocker accepting nullptrs more generically :)

@phohensee
Copy link
Member Author

linux-x86 langtools/tools/javac/varargs/warning/Warn4.java presubmit test failure is a crash in G1ConcurrentMark.cpp which appears unrelated. Rerun on my test box succeeded.

@phohensee
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Jul 26, 2023

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

  • 4c2e54f: 8309088: security/infra/java/security/cert/CertPathValidator/certification/AmazonCA.java fails
  • 830413f: 8313087: DerValue::toString should output a hex view of the values in byte array
  • 7412193: 4800398: (ch spec) Clarify Channels.newChannel(InputStream) spec
  • e7726fb: 8313155: Problem list some JUnit-based tests in test/jdk/java/lang/invoke
  • 02a0473: 8312445: Array types in annotation elements show square brackets twice
  • c22cadf: 8312526: Test dk/jfr/event/oldobject/TestHeapDeep.java failed: Could not find ChainNode
  • cc2a75e: 8312619: Strange error message when switching over long
  • 1f81e5b: 8312229: Crash involving yield, switch and anonymous classes
  • e9daf4a: 8312916: Remove remaining usages of -Xdebug from test/hotspot/jtreg
  • 117f42d: 8312625: Test serviceability/dcmd/vm/TrimLibcHeapTest.java failed: RSS use increased
  • ... and 1 more: https://git.openjdk.org/jdk/compare/78a8a99d990dcc0b77c096bb2ca2c1bb86462e3f...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jul 26, 2023

@phohensee Pushed as commit a9d21c6.

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

@@ -2116,6 +2116,7 @@ JVM_ENTRY(jlong, jmm_GetTotalThreadAllocatedMemory(JNIEnv *env))
}

{
assert(MonitoringSupport_lock != nullptr, "Must be");
Copy link
Member

Choose a reason for hiding this comment

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

This was unnecessary. If you have this here you would have one before every single use of mutex that is expected to be non-null.

@phohensee phohensee deleted the 8313081 branch July 31, 2023 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated jmx jmx-dev@openjdk.org serviceability serviceability-dev@openjdk.org
4 participants