-
Notifications
You must be signed in to change notification settings - Fork 127
8370479: [lworld] OOP-related crashes via mvn surefire #1713
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
|
👋 Welcome back phubner! A progress list of the required criteria for merging this PR into |
|
@Arraying 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 8 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. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@fparain, @coleenp) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
fparain
left a comment
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.
Good catch on the memory barrier!
LGTM.
coleenp
left a comment
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.
Great bug fix and find and very nice comments.
| bool java_lang_String::is_instance_without_asserts(oop obj) { | ||
| return obj != nullptr && obj->klass_without_asserts() == vmClasses::String_klass(); | ||
| } | ||
|
|
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.
Can you make a small upstream patch for this in mainline (either in addition or instead of this part of the change?)
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.
Sure, I'll do it separately, I want to get this fixed in Valhalla ASAP.
|
/sponsor |
|
Going to push as commit 6f5c72e.
Your commit was automatically rebased without conflicts. |
Hi all,
This PR fixes JDK-8370479, as we currently don't emit barriers correctly. Tested tiers 1-3.
Context
If we consider a value class/record that contains a single field, which is a reference to an identity object:
We can create a flattened array via the JDK-internal
ValueClassAPI:This will indeed be flattened when running with compressed oops. T the reference to
underlyingwill be four bytes, and the null-marker an additional byte. Hence, we are below the 64-bit limit. Copying this array viaArrays.copyOfwill trigger Valhalla-specific copying.When running with G1, there are various crashes and verification errors. This should not impact ZGC, as the pointers are too large to be flattened in a nullable array.
New Barrier Emission
We do not emit a post-write barrier when copying to an uninitialized memory destination. The tables below summarize what barriers, if any, are emitted both in the old and new versions of the copy implementation. Note that Serial, Parallel and G1 have the notion of post-write barriers to track intergenerational references. G1 is the only GC requiring pre-write barriers.
Old G1 barrier emission during flat array copying:
New G1 barrier emission during flat array copying:
As mentioned, when copying to uninitialized memory, a cross-generational could be "lost" due to the lack of a post-write barrier. We should not use a pre-write barrier when copying to uninitialized memory when running with G1. Doing so means we may get garbage in our SATB buffers.
New Test Cases
I introduce a test scenario where we grow a flat array similar to how one would grow an
ArrayList. This should generate plenty of garbage, and triggers this crash even without the whitebox GC. I test the three GCs that useModRefBarrierSet: Serial, Parallel and G1. These are tweaked to be less concurrent/parallel to aid with reproducability in case of crashes.Fixed Oop Printing
When G1 verification fails, it tries to print diagnostic information. This will eventually end up printing oops. We handle the case of
Stringoops specially, and for that we need to check the klass. However, in this failed verification state, we can't guarantee that the class isn't garbage (either through a race or literal garbage). While debugging this issue, I ran into a scenario where the klass does not pass assertion. Consequently, we crash before the helpful diagnostic error messages finish printing. I've introduced aklass_without_assertsversion of the string check, intended to be used only for diagnostics, which will perform theStringcheck even if the VM is metaphorically on fire after a failed GC. That way, G1 is able to finish printing what it wants to print.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/1713/head:pull/1713$ git checkout pull/1713Update a local copy of the PR:
$ git checkout pull/1713$ git pull https://git.openjdk.org/valhalla.git pull/1713/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1713View PR using the GUI difftool:
$ git pr show -t 1713Using diff file
Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1713.diff
Using Webrev
Link to Webrev Comment