RFR: 8286978: SIGBUS in libz during CDS initialization [v2]
Ioi Lam
iklam at openjdk.java.net
Fri May 20 06:27:43 UTC 2022
On Fri, 20 May 2022 05:37:27 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:
>> Please review this fix to ensure all requested bytes are transferred by calling `FileChannel.transferFrom` in a loop and checking its return value.
>>
>> Tested by running the SharedArchiveConsistency.java test on linux-aarch64 30 times on each of the following tier3 options:
>>
>> - `-XX:+CreateCoredumpOnCrash -XX:+UseSerialGC `
>> - `-XX:+CreateCoredumpOnCrash -XX:+UseParallelGC -XX:+UseNUMA`
>
> Calvin Cheung has updated the pull request incrementally with one additional commit since the last revision:
>
> corrected the condition of the while loop, removed an unneeded line of code
Changes requested by iklam (Reviewer).
test/lib/jdk/test/lib/cds/CDSArchiveUtils.java line 440:
> 438: transferFrom(inputChannel, outputChannel, 0, offset);
> 439: outputChannel.position(offset);
> 440: outputChannel.write(ByteBuffer.wrap(bytes));
The changes for transferFrom looks good, but we still have a problem with outputChannel.write(), which can also return fewer bytes than requested (or even zero).
For simplicity, I think it's best to ditch FileChannel and use FileOutputStream.write() instead.
test/lib/jdk/test/lib/cds/CDSArchiveUtils.java line 458:
> 456: transferFrom(inputChannel, outputChannel, 0, offset);
> 457: inputChannel.position(offset + nBytes);
> 458: long length = orgSize - nBytes;
Line 458 doesn't seem to be needed.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8799
More information about the hotspot-runtime-dev
mailing list