-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8255917: runtime/cds/SharedBaseAddress.java failed "assert(reserved_rgn != 0LL) failed: No reserved region" #1750
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
Conversation
…gn != 0LL) failed: No reserved region"
|
👋 Welcome back minqi! A progress list of the required criteria for merging this PR into |
Webrevs
|
| * @requires vm.cds | ||
| * @library /test/lib | ||
| * @compile test-classes/Hello.java | ||
| * @run main/timeout=240 MismatchedPathTriggerMemoryRelease |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this test requires more than the default timeout (120s) to run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this test requires more than the default timeout (120s) to run?
No, I will fix it. Thanks.
| execOutput = TestCommon.exec("non-exist.jar", | ||
| "-Xshare:auto", | ||
| "-Xlog:os,cds=debug", | ||
| "-XX:NativeMemoryTracking=detail", | ||
| "-XX:SharedBaseAddress=0", | ||
| "Hello"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of TestCommon.exec, you could use TestCommon.execAuto and no need to pass the -Xshare:auto argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to execAuto, remove "-Xshare:auto", it failed on "Error: Could not find or load main class non-exist.jar" so i will keep original version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you'll need to add "-cp" before "non-exist.jar" for execAuto to work.
I'm fine to leave it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more comment regarding the test. Up to you if you want to make the change.
src/hotspot/share/runtime/os.cpp
Outdated
| res = pd_release_memory(addr, bytes); | ||
| } | ||
| if (!res) { | ||
| log_info(os)("os::release_memory(" PTR_FORMAT ", " SIZE_FORMAT ") failed", p2i(addr), bytes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better to use "os::release_memory failed (" PTR_FORMAT ", " SIZE_FORMAT ")". That way it's easy to match the error message in the test case with a simple substring test of "os::release_memory failed". Otherwise it's hard to see that the regexp in the test "os::release_memory\\(0x[0-9a-fA-F]*,\\s[0-9]*\\)\\sfailed" indeed would match the error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion. Will make the check in test simple. (I have tested the pattern using online java pattern match and a local test program for it).
Thanks
Yumin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@yminqi 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: 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 24 new commits pushed to the
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
|
@iklam @calvinccheung Thanks for review. I will wait for @tstuefe input for integration. |
|
Hi Yumin, I don't understand the special handling in NMT. Unix: We reserve a region, split it, tell NMT about the split (see posix version of os::split_reserved_memory), then later release both parts separately.
Where is this new NMT coding needed? Thanks, Thomas |
|
Hi, Thomas
The space reserved as a whole, and we did not do the 'split' on it. The release should be on whole too. When unmapping regions, the released on region in fact did not do anything in nmt since it is within the archive space. Since the new code is release on the whole space (there is no call to release on class_space_rs in this case), so it check if it is > archive_space_rs (with tag of mtClassShared) we know it is for releasing the whole space. The space which is bigger than archive_space_rs with tag of mtClassShared should be only the whole space.
The code is to make the bytes in snapshot correct. That, when all the spaces release, the bytes in the reserved slot should be 'zero'. Thanks for review. |
Okay. Lets see if I understand: For (2) and for Unix, we reserve the total area. Then we tell NMT to semantically split it up in two regions ( Right? Also: the section at -- Going forward, I wonder whether NMT should have general support for releasing multiple mappings in one go. Since we introduced the concept of "artificial split" with
The rest looks good AFAICS. For JDK17, I really hope we can simplify and streamline this coding. Maybe if we consider one or two things:
What do you think, does that make sense? Thanks, Thomas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@tstuefe Thanks for review, next os::split_reserved_memory will be removed (https://bugs.openjdk.java.net/browse/JDK-8256213). |
|
/integrate |
|
@yminqi Since your change was applied there have been 27 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 36e2097. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Hi, Please review
(This is redo for #1657)
Windows mapping for file into memory could not happen to reserved memory. In mapping CDS archive we first reserve enough memory then before mapping, release them. For cds archive and using class space, need split the whole space into two spaces. To do so, we need release the whole first then do the reserve again on the split, which is problematic that there is possibility other thread or system can kick in to take the released space.
The fix is the first step of two steps:
This fix is first step, for Windows and use requested mapping address, reserved for cds archive and ccs on a contiguous space separately, so there is no need to call split. If any reservation failed, go to other way, but do not do the 'real' split for the whole reserved space, keep the whole region reserved and released as a whole.
Also fixed issues that when loading shared archive failed, bitmap region should be unmapped or it will cause mismatch in reserved/committed size calculation for NMT.
Fixed reserved region name for adding committed region for NMT, it should use the reserved region name not "Unknown" the default.
A test case added for testing the failed case which is caused by mismatch of class path.
Tests:tier1-5,tier7
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/1750/head:pull/1750$ git checkout pull/1750