-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8357525: Default CDS archive becomes non-deterministic after JDK-8305895 #25373
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
8357525: Default CDS archive becomes non-deterministic after JDK-8305895 #25373
Conversation
|
👋 Welcome back iklam! A progress list of the required criteria for merging this PR into |
|
@iklam 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 94 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 |
Webrevs
|
shipilev
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.
This looks fine.
Looks to me we mis-attributing the root cause a bit: it is not just about JDK-8305895 that made some IK-s allocated at more arbitrary locations outside of Class Space. Even in Class Space there is a positional randomness, right?
So I think the actual root cause is the the address-based tie-breaker introduced in JDK-8180450. Let's link those issues up and change the synopsis accordingly?
src/hotspot/share/oops/klass.cpp
Outdated
| // output buffer, so they should have deterministic values. If we rehash | ||
| // _secondary_supers, its elements will appear in a deterministic order. | ||
| // | ||
| // Note that the bitmap is guatanteed to be deterministic, regardless of 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.
| // Note that the bitmap is guatanteed to be deterministic, regardless of the | |
| // Note that the bitmap is guaranteed to be deterministic, regardless of the |
I updated the PR and JBS synopsis to include JDK-8180450. Determinism is required only when creating the default CDS archive during the JDK build, where we run a single thread to load the classes. As far as I know, the address order in the class space happens to be the same as in the CDS output buffer, but that's just a happy co-incidence and could change in the future. This RFE will guard against such changes. |
shipilev
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.
I don't see the bug synopsis update, but PR looks good.
|
It was actually JDK-8338526 this change that moved interface and abstract classes into non-class metaspace. |
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.
This looks good but I also think the synopsis should be updated. A bit disconcerting that now remove_unshareable_info() has side effects. Maybe it should be renamed to something like make_shareable() with some future RFE.
|
Going to push as commit 2ec6ab3.
Your commit was automatically rebased without conflicts. |
Since JDK-8305895, interfaces and abstract classes are allocated outside of the class space. See here for the triggering condition
Theoretically such InstanceKlasses can have arbitrary addresses, so the "tie breaker test" of
(uintptr_t(existing) < uintptr_t(klass))in Klass::hash_insert() no longer produces a deterministic result across two JVM runs. As a result, we have seen several occurrence of non-deterministic CDS archives in our test pipeline for a short period after JDK-8305895 for pushed.Thereafter, for some unknown reason, the problem disappears. However, we could just be lucky due to allocation policy changes in metaspace. The underlying cause still exists.
I wrote a proof of concept that shows the problem. See 3318570
With the fix, we re-hash the copy of the
secondary_supersin the CDS archive. When InstanceKlasses are copied into the CDS archive, they are sorted by their names. This makes the(uintptr_t(existing) < uintptr_t(klass))comparison produce deterministic results.Unfortunately it's not possible to write a jtreg test for this problem.
Note: the "tie breaker test" was introduced in JDK-8180450. It adds an assumption that the address order of classes in the CDS archive buffer is the same as the classes in the class space, which can become invalid if the class space allocation algorithm changes.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25373/head:pull/25373$ git checkout pull/25373Update a local copy of the PR:
$ git checkout pull/25373$ git pull https://git.openjdk.org/jdk.git pull/25373/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 25373View PR using the GUI difftool:
$ git pr show -t 25373Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25373.diff
Using Webrev
Link to Webrev Comment