RFR: 8329757: Crash with fatal error: DEBUG MESSAGE: Fast Unlock lock on stack
Patricio Chilano Mateo
pchilanomate at openjdk.org
Thu Apr 11 03:33:41 UTC 2024
On Wed, 10 Apr 2024 12:11:17 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
> `Deoptimization::relock_objects` may reorder locks within in the `LockStack` which are added inside the same vframe. This can be handled by the interpreter but if OSR has occurred C2 may observe this invalid order in the `LockStack`, which breaks its assumption leading to incorrect behaviour.
>
> This patch functionally makes sure that the LockStack is always consistent by always inflating eliminated locks when `Deoptimization::relock_objects` is called.
>
> It also adds verification code which checks that the LockStack is consistent with the lock order observed inside the deoptimized vframes.
>
> Note: for leaf deoptimizations we have enough information to recreate a correct top of the LockStack with minimal inflations, however that should be a separate RFE. This only inflates eliminated locks so the worth of solving that may be minimal or even detrimental.
>
> Tests still running. Tier 1-5 done, Tier 6-7 running.
Fix looks good to me. Looking at 8318895 seems we missed this subtle OSR case when the fix was restricted to Unpack_none only.
src/hotspot/share/runtime/deoptimization.cpp line 72:
> 70: #include "runtime/fieldDescriptor.inline.hpp"
> 71: #include "runtime/frame.inline.hpp"
> 72: #include "runtime/globals.hpp"
Is this extra include needed?
src/hotspot/share/runtime/deoptimization.cpp line 96:
> 94: #include "utilities/checkedCast.hpp"
> 95: #include "utilities/events.hpp"
> 96: #include "utilities/globalDefinitions.hpp"
Same.
src/hotspot/share/runtime/lockStack.cpp line 119:
> 117: if (_base[index] == obj) {
> 118: // Found top index
> 119: top_index = index + 1;
Maybe add a break to make it more readable that we are exiting the loop once we find a match?
src/hotspot/share/runtime/lockStack.cpp line 149:
> 147: assert(!mark.is_fast_locked(), "must be inflated");
> 148: assert(mark.monitor()->owner_raw() == get_thread() ||
> 149: get_thread()->current_waiting_monitor() == mark.monitor(),
We can add the !leaf_frame condition for the waiting monitor case.
-------------
PR Review: https://git.openjdk.org/jdk/pull/18715#pullrequestreview-1993145581
PR Review Comment: https://git.openjdk.org/jdk/pull/18715#discussion_r1560389809
PR Review Comment: https://git.openjdk.org/jdk/pull/18715#discussion_r1560392161
PR Review Comment: https://git.openjdk.org/jdk/pull/18715#discussion_r1560337025
PR Review Comment: https://git.openjdk.org/jdk/pull/18715#discussion_r1560338726
More information about the hotspot-dev
mailing list