RFR: 8264413: Data is written to file header even if its CRC32 was calculated [v3]

Calvin Cheung ccheung at openjdk.java.net
Wed Mar 31 02:02:24 UTC 2021


On Tue, 30 Mar 2021 13:53:34 GMT, Yi Yang <yyang at openjdk.org> wrote:

>> Many tests under `runtime/cds/appcds/dynamicArchive` are crashed when turning on VerifySharedSpaces, VM reports inconsistent crc32 between dumptime and runtime(See detailed content on JBS attachments):
>> 
>> $ diff dump.log run.log
>> 17c17
>> < - base_archive_is_default:        0
>> ---
>>> - base_archive_is_default:        1
>> 19c19
>> < - base_archive_name_size:         0
>> ---
>>> - base_archive_name_size:         113
>> 
>> The root cause is that even if the CRC32 is calculated(Line 1902), ArchiveBuilder is still writing data to FileMapInfo(Line 1903):
>> 
>> https://github.com/openjdk/jdk/blob/4ea6abfbd1818fa7049bc4f6e46d568e842acb34/src/hotspot/share/memory/archiveBuilder.cpp#L1091-L1094
>> 
>> https://github.com/openjdk/jdk/blob/4ea6abfbd1818fa7049bc4f6e46d568e842acb34/src/hotspot/share/memory/filemap.cpp#L1236-L1251
>> 
>> Now the expected CRC32(serialized in CDS archive) is different from the calculated ones at runtime. This patch addresses this problem, it writes base_archive_name and size into header **before** calculating CRC32(if needed).
>> 
>> Thanks~
>> Yang
>
> Yi Yang has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
> 
>   Data is written to file header even if its CRC32 was calculated

Looks good.
I've tried your patch on linux-x64. It passed all cds tests and also in dynamic archive mode by specifying `-vmoptions:'-Dtest.dynamic.cds.archive=true -XX:+VerifySharedSpaces'` and test group `<open repo>/test/hotspot/jtreg:hotspot_appcds_dynamic` to the jtreg command line. It also passed the first 4 tiers of testing on Oracle supported platforms.
I've filed the following RFE for adding a test group for running CDS tests with -XX:+VerifySharedSpaces:
https://bugs.openjdk.java.net/browse/JDK-8264472

-------------

Marked as reviewed by ccheung (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/3261


More information about the hotspot-runtime-dev mailing list