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

Yi Yang yyang at openjdk.java.net
Tue Mar 30 09:33:49 UTC 2021


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

which results in 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 before calculating CRC32 if needed.

Thanks~
Yang

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

Commit messages:
 - Data is written to file header even if its CRC32 was calculated

Changes: https://git.openjdk.java.net/jdk/pull/3261/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3261&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8264413
  Stats: 26 lines in 3 files changed: 16 ins; 8 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3261.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3261/head:pull/3261

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


More information about the hotspot-runtime-dev mailing list