RFR: 8371320: runtime/ErrorHandling/PrintVMInfoAtExitTest.java fails with unexpected amount for Java Heap reserved memory
Joel Sikström
jsikstro at openjdk.org
Thu Nov 13 08:17:21 UTC 2025
On Thu, 6 Nov 2025 16:36:33 GMT, Paul Hübner <phubner at openjdk.org> wrote:
> Hi all,
>
> In [JDK-8364741](https://bugs.openjdk.org/browse/JDK-8364741) it was discovered that asan reserves a bit more heap. The test got patched by checking for asan and adjusting the expectation, respectively.
>
> It turns out that, rarely, we do reserve more memory even without asan enabled. This change updates the test:
> a) to ensure that some sort of reservation size is reported; and
> b) to extract the reserved amount and assert that it is no less than the committed amount
>
> Testing: Ran tier1. Stress tested the individual test with 5x100 repetitions per platform (Linux x64, AArch64; macOS x64, AArch64; Windows x64).
Yes, for some reason the reserved value is greater than the committed value. We've been speculating that it might be a NMT bug, a CDS thing (which also uses the `mtJavaHeap` NMT tag) or something else.
The approach of checking `reserved >= committed` is a valid approach, but I also think we could just scrap the entire check for the reserved value. The purpose of this test is really to check if the `-XX:+PrintVMInfoAtExit` flag works as intended, which means it should include the NMT summary. Again, if we only care that the NMT summary is printed, we could check for more robust "strings", or just skip checking for an exact reserved value.
Either way, this test has been failing for some time due to the reserved discrepancy so any fix is fine IMO.
test/hotspot/jtreg/runtime/ErrorHandling/PrintVMInfoAtExitTest.java line 61:
> 59: output_detail.shouldMatch("Java Heap \\(reserved=[0-9]+KB, committed=" + committed_kb + "KB\\)");
> 60: // Check reserved >= committed.
> 61: String reserved_kb_string = output_detail.firstMatch("reserved=([0-9]+)KB, committed=" + committed_kb + "KB", 1);
This will likely always match the "Java Heap" line, but should we be more explicit and add "Java Heap" like this?
Suggestion:
String reserved_kb_string = output_detail.firstMatch("Java Heap \(reserved=([0-9]+)KB, committed=" + committed_kb + "KB\)", 1);
-------------
Marked as reviewed by jsikstro (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/28179#pullrequestreview-3458228004
PR Review Comment: https://git.openjdk.org/jdk/pull/28179#discussion_r2522180397
More information about the hotspot-runtime-dev
mailing list