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
8253079: DeterministicDump.java fails due to garbage in structure padding #267
8253079: DeterministicDump.java fails due to garbage in structure padding #267
Conversation
|
@iklam The following label will be automatically applied to this pull request: 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 |
Webrevs
|
The implementation is quite complex, every derivatives from BasicHashTableEntry need to have a copy_from function to avoid such problem. Maybe a brutal one to avoid such padding issue for all cases is fill the object allocated in AllocateHeap with \0? |
…age in structure padding" This reverts commit d380e02.
…terministicDump-test-fails-product-build
You're right. My original analysis was wrong: set_hash() didn't write garbage into the padding. Instead, the garbage was there because AllocaHeap didn't initialize the new buffer in product builds. I reverted the original fix. Instead, I added code to call memset() when allocating a new hashtable entry (but only when DumpSharedSpaces is true). |
@@ -454,6 +454,7 @@ void ModuleEntry::init_as_archived_entry() { | |||
if (_location != NULL) { | |||
_location = ArchiveBuilder::get_relocated_symbol(_location); | |||
} | |||
JFR_ONLY(memset(trace_id_addr(), 0, sizeof(traceid))); |
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.
memset
looks dodgy here. Maybe JFR_ONLY(set_trace_id(0))
?
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 removed these from my previous commit, because the trace_id seemed to be predictable and wouldn't cause the archive content to change. Anyway, I've added the code you suggested in commit 5706a82. That way, if trace_ids become unpredictable due to future JFR implementation changes, the CDS code won't be affected.
@@ -238,6 +238,7 @@ void PackageEntry::init_as_archived_entry() { | |||
_module = ModuleEntry::get_archived_entry(_module); | |||
_qualified_exports = (GrowableArray<ModuleEntry*>*)archived_qualified_exports; | |||
_defined_by_cds_in_class_path = 0; | |||
JFR_ONLY(memset(trace_id_addr(), 0, sizeof(traceid))); |
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.
Ditto, JFR_ONLY(set_trace_id(0))
?
It passed with this fix. |
/reviewer jiefu |
@DamonFool Only the author (@iklam) is allowed to issue the |
@iklam 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:
Since the source branch of this PR was last updated there have been 19 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 automatic rebasing, please merge
|
/reviewer jiefu |
@iklam Syntax:
|
/reviewer credit jiefu |
@iklam |
/integrate |
@iklam Since your change was applied there have been 19 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 284bbf0. |
(EDITED) In product builds, when
PackageEntry
andModuleEntry
objects are allocated, the memory is not zeroed. As a result, the structure padding slots (such as the 32-bits afterBasicHashtableEntry::_hash
) may contain garbage values that are different on every run ofjava -Xshare:dump
. As a result,java -Xshare:dump
cannot reproduce deterministic result.The fix is to clear the memory for the newly allocated
HashtableEntry
objects whenDumpSharedSpaces == true
.Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jdk pull/267/head:pull/267
$ git checkout pull/267