RFR: 8365656: [ubsan] G1CSetCandidateGroup::liveness() reports division by 0 [v4]
Thomas Schatzl
tschatzl at openjdk.org
Mon Aug 25 10:34:11 UTC 2025
> Hi all,
>
> please review this change that fixes a div-by-zero in calculating liveness for logging.
>
> It is possible that the young gen group cardset is empty (has no regions assigned to it as no eden region has retired yet) when the `Cleanup` pause starts, making the liveness calculation divide by zero.
>
> The change special-cases this case when printing - I decided to always print the group in this case, regardless of length, just fudging the output value a bit. An alternative would be not printing it at all in this case. Feel free to argue for that solution. Also the printed value for liveness (0.0%) is up for discussion.
>
> Testing: failing test case does not fail any more now and then, gha, tier1-4
>
> Thanks,
> Thomas
Thomas Schatzl has updated the pull request incrementally with one additional commit since the last revision:
* make liveness_percent() fail on an empty group, check before use
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/26888/files
- new: https://git.openjdk.org/jdk/pull/26888/files/496d9bb4..3730e498
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=26888&range=03
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=26888&range=02-03
Stats: 5 lines in 2 files changed: 0 ins; 2 del; 3 mod
Patch: https://git.openjdk.org/jdk/pull/26888.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/26888/head:pull/26888
PR: https://git.openjdk.org/jdk/pull/26888
More information about the hotspot-gc-dev
mailing list