Integrated: 8368367: Test jdk/jfr/event/gc/detailed/TestGCHeapMemoryUsageEvent.java fails jdk.GCHeapMemoryUsage "expected 0 > 0"
Thomas Schatzl
tschatzl at openjdk.org
Wed Sep 24 13:41:10 UTC 2025
On Tue, 23 Sep 2025 12:39:03 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
This pull request has now been integrated.
Changeset: ed31023f
Author: Thomas Schatzl <tschatzl at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/ed31023fc5a96a6f9a16c8a5c0fc86e794ce4aa7
Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
8368367: Test jdk/jfr/event/gc/detailed/TestGCHeapMemoryUsageEvent.java fails jdk.GCHeapMemoryUsage "expected 0 > 0"
Reviewed-by: iwalulya, ayang, syan
-------------
PR: https://git.openjdk.org/jdk/pull/27451
More information about the hotspot-dev
mailing list