RFR: 8368367: Test jdk/jfr/event/gc/detailed/TestGCHeapMemoryUsageEvent.java fails jdk.GCHeapMemoryUsage "expected 0 > 0" [v2]
Ivan Walulya
iwalulya at openjdk.org
Tue Sep 23 15:34:39 UTC 2025
On Tue, 23 Sep 2025 14:41:18 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:
>> Hi all,
>>
>> please review this change to the TestGCHeapMemoryUsageEvent test that checks whether these kind of events are posted and contain some sensibles values.
>>
>> In this failure, the `used` metric for the first of two events that is checked was zero. This is because G1, the default collector, updates the `used` value only at certain synchronization points to avoid inconsistencies in other cases. One of these synchronization points is region refill. With the 30gb heap in the test environment, region size is larger than what is allocated during startup, so no region refill/synchronization point has been reached yet, and `used` turns out to be `0`.
>>
>> This change fixes this by checking the last event instead of the first, it must have happened after that `system.gc()` call in the test, and `used` ought to be larger than zero because of allocations during VM startup.
>>
>> An alternative could be limiting the test's heap size to something small, that would also help, but I thought this might need additional explanations.
>>
>> Testing: local runs with G1 heap region size >= 16M or so do not fail any more.
>>
>> Thanks,
>> Thomas
>
> Thomas Schatzl has updated the pull request incrementally with one additional commit since the last revision:
>
> * fix copyright year
Marked as reviewed by iwalulya (Reviewer).
-------------
PR Review: https://git.openjdk.org/jdk/pull/27451#pullrequestreview-3258591606
More information about the hotspot-dev
mailing list