RFR: 8351491: Add info from release file to hserr file [v4]

David Holmes dholmes at openjdk.org
Tue Apr 8 08:03:24 UTC 2025


On Mon, 7 Apr 2025 15:03:47 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> The release file of the JDK image contains useful info, for example the SOURCE used to built this image e.g.
>> SOURCE=".:git:21af8c7e7405"
>> Also the MODULES list is probably useful to have.
>> Add this info (or the complete content of the release file) to the hs_err files.
>
> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
> 
>   use stringStream in os.cpp, add a couple of changes suggested by David

Changes requested by dholmes (Reviewer).

src/hotspot/share/runtime/os.cpp line 1538:

> 1536:   ss.print("%s/release", home);
> 1537: 
> 1538:   if (_image_release_file_content == nullptr) {

Shouldn't we check before doing anything else i.e. make line 1538 first.

Also for race concerns use load_acquire on `image_release_file_content`.

src/hotspot/share/runtime/os.cpp line 1550:

> 1548:     fseek(file, 0, SEEK_SET);
> 1549: 
> 1550:     _image_release_file_content = (char*) os::malloc(sz + 1, mtInternal);

For race concerns do everything to a tmp variable and finally do a release_store into `_image_release_file_content`.

src/hotspot/share/runtime/os.cpp line 1573:

> 1571: 
> 1572: void os::print_image_release_file(outputStream* st) {
> 1573:   if (_image_release_file_content != nullptr) {

Use load_acquire.

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

PR Review: https://git.openjdk.org/jdk/pull/24244#pullrequestreview-2749042138
PR Review Comment: https://git.openjdk.org/jdk/pull/24244#discussion_r2032622103
PR Review Comment: https://git.openjdk.org/jdk/pull/24244#discussion_r2032623469
PR Review Comment: https://git.openjdk.org/jdk/pull/24244#discussion_r2032624359


More information about the hotspot-dev mailing list