RFR: 8339288: Improve diagnostic logging runtime/cds/DeterministicDump.java

Matias Saavedra Silva matsaave at openjdk.org
Tue Nov 5 19:31:59 UTC 2024


The test `DeterministicDump.java` fails frequently since it is sensitive to changes in CDS, and with it's current logging, it is very difficult to diagnose the root cause of these failures. The current output looks like this:


STDERR:
java.lang.RuntimeException: File content different at byte #4, b0 = 96, b1 = 80
at DeterministicDump.compare(DeterministicDump.java:114)
at DeterministicDump.doTest(DeterministicDump.java:73)
at DeterministicDump.main(DeterministicDump.java:42)


This is not useful information since it indicates that the checksum of both archives is different, which does not reveal where the actual difference is. This patch introduces a more complete log message to STDOUT which shows the first meaningful difference between the archives. 

The new output looks like this:

[First diff: map file #1 (SharedArchiveFile0.map)]
0x00000008005a2cc0:   616a001628f3ffff 2f676e616c2f6176 506e6f6973726556 0000000073706f72   ...(..java/lang/VersionProps....
0x00000008005a2ce0: @@ Symbol            24 java_version
0x00000008005a2ce0:   616a000c22cbffff 69737265765f6176 0000000000006e6f                    ..."..java_version......
0x00000008005a2cf8: @@ Symbol            24 java_runtime_name
0x00000008005a2cf8:   616a001199c6ffff 69746e75725f6176 00656d616e5f656d                    ......java_runtime_name.
0x00000008005a2d10: @@ Symbol            32 java_runtime_version

[First diff: map file #2 (SharedArchiveFile1.map)]
0x00000008005a2cc0:   616a00168eb4ffff 2f676e616c2f6176 506e6f6973726556 0000000073706f72   ......java/lang/VersionProps....
0x00000008005a2ce0: @@ Symbol            24 java_version
0x00000008005a2ce0:   616a000caa09ffff 69737265765f6176 0000000000006e6f                    ......java_version......
0x00000008005a2cf8: @@ Symbol            24 java_runtime_name
0x00000008005a2cf8:   616a00112175ffff 69746e75725f6176 00656d616e5f656d                    ..u!..java_runtime_name.
0x00000008005a2d10: @@ Symbol            32 java_runtime_version

Byte #5910530 at line #235510 word #0:
SharedArchiveFile0.map: 616a001628f3ffff 
SharedArchiveFile1.map: 616a00168eb4ffff 


This change was verified locally by generating non-deterministic archives and map files.

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

Commit messages:
 - 8339288: Improve diagnostic logging runtime/cds/DeterministicDump.java

Changes: https://git.openjdk.org/jdk/pull/21913/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21913&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8339288
  Stats: 88 lines in 1 file changed: 83 ins; 0 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/21913.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21913/head:pull/21913

PR: https://git.openjdk.org/jdk/pull/21913


More information about the hotspot-runtime-dev mailing list