Integrated: 8332506: SIGFPE In ObjectSynchronizer::is_async_deflation_needed()
Fredrik Bredberg
fbredberg at openjdk.org
Wed Jan 8 09:52:49 UTC 2025
On Wed, 18 Dec 2024 15:33:43 GMT, Fredrik Bredberg <fbredberg at openjdk.org> wrote:
> This PR solves a division by zero problem, that according to the bug report happened in `ObjectSynchronizer::is_async_deflation_needed()`. As it turns out it really happened in the inlined `monitors_used_above_threshold()` function. The problematic line looked like this:
>
> `size_t monitor_usage = (monitors_used * 100LL) / ceiling;`
>
> Unfortunately the `ceiling` value was increased every time there where too many deflations without any progress. This whould eventually lead to an overflow in the `ceiling` value, and in unlucky circumstances, it would become zero. Thus causing a division by zero crash.
>
> This PR makes sure not to increase the `ceiling` value if `monitor_usage` is below the `MonitorUsedDeflationThreshold`.
> It also makes sure the ceiling value is never zero, and does not wrap around.
>
> Tested okay in tier1-5 and `test/hotspot/jtreg/runtime/Monitor/MonitorUsedDeflationThresholdTest.java`
This pull request has now been integrated.
Changeset: cbabc045
Author: Fredrik Bredberg <fbredberg at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/cbabc0451505a00dfe77c163190736460c53820f
Stats: 45 lines in 1 file changed: 25 ins; 12 del; 8 mod
8332506: SIGFPE In ObjectSynchronizer::is_async_deflation_needed()
Reviewed-by: coleenp, dholmes
-------------
PR: https://git.openjdk.org/jdk/pull/22815
More information about the hotspot-runtime-dev
mailing list