RFR: 8339288: Improve diagnostic logging runtime/cds/DeterministicDump.java [v2]
Ioi Lam
iklam at openjdk.org
Sat Nov 9 04:31:24 UTC 2024
On Fri, 8 Nov 2024 18:46:46 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:
>> 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)]
>> [ro region 0x00000008005a2000 - 0x0000000800ea7058 9457752 bytes]
>> 0x00000008005a2cb0: 6f66000a8da9ffff 6c61766f6d655272 ......forRemoval
>> 0x00000008005a2cc0: @@ Symbol 32 java/lang/VersionProps
>> 0x00000008005a2cc0: 616a0016959bffff 2f676e616c2f6176 506e6f6973726556 0000000073706f72 ......java/lang/VersionProps....
>> 0x00000008005a2ce0: @@ Symbol 24 java_version
>> 0x00000008005a2ce0: 616a000c335cffff 69737265765f6176 0000000000006e6f ..\3..java_version......
>>
>> [First diff: map file #2 (SharedArchiveFile1.map)]
>> [ro region 0x00000008005a2000 - 0x0000000800ea7058 9457752 bytes]
>> 0x00000008005a2cb0: 6f66000ae5fcffff 6c61766f6d655272 ......forRemoval
>> 0x00000008005a2cc0: @@ Symbol 32 java/lang/VersionProps
>> 0x00000008005a2cc0: 616a00169955ffff 2f676e616c2f6176 506e6f6973726556 0000000073706f72 ..U...java/lang/VersionProps....
>> 0x00000008005a2ce0: @@ Symbol 24 java_version
>> 0x00000008005a2ce0: 616a000ca147ffff 69737265765f6176 0000000000006e6f ..G...java_version......
>>
>> Byte #5910530 at line #235510 word #0:
>> SharedArchiveFile0.map: 616a0016959bffff
>> SharedArchiveFile1.map: 616a00169955ffff
>>
>>
>> This change was verified locally by generating non-deterministic archives and map files.
>
> Matias Saavedra Silva has updated the pull request incrementally with one additional commit since the last revision:
>
> Now prints preceding lines and region name
Two suggestions:
(1) I think it will be good to print an indicator on the line that differs. Something like
[First diff: map file #2 (SharedArchiveFile1.map)]
[ro region 0x00000008005a2000 - 0x0000000800ea7058 9457752 bytes]
0x00000008005a2cb0: 6f66000ae5fcffff 6c61766f6d655272 ......forRemoval
0x00000008005a2cc0: @@ Symbol 32 java/lang/VersionProps
0x00000008005a2cc0: 616a00169955ffff 2f676e616c2f6176 506e6f6973726556 0000000073706f72 ..U...java/lang/VersionProps....
0x00000008005a2ce0: @@ Symbol 24 java_version
>0x00000008005a2ce0: 616a000ca147ffff 69737265765f6176 0000000000006e6f ..G...java_version......
(2) Sometimes an object spans over many lines. It will be good to remember the first line of the very last object (the `0x00000008005a2ce0: @@ Symbol` in your example). If that line is more than 4 lines above the first diff, then print something like this:
0x00000008005a2ce0: @@ Symbol 24 java_version
[....]
before printing the rest of the output.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21913#issuecomment-2466040940
More information about the hotspot-runtime-dev
mailing list