RFR: 8366659: ObjectMonitor::wait() liveness problem with a suspension request [v24]

David Holmes dholmes at openjdk.org
Tue Jan 20 11:47:56 UTC 2026


On Tue, 20 Jan 2026 09:01:47 GMT, Anton Artemov <aartemov at openjdk.org> wrote:

>> src/hotspot/share/runtime/objectMonitor.cpp line 2296:
>> 
>>> 2294:   // unparked directly in notify_internal(). Its state is then TS_RUN.
>>> 2295:   if (state == ObjectWaiter::TS_RUN) {
>>> 2296:     bool acquired = vthread_monitor_enter(current, node);
>> 
>> If we get here due to the direct unpark is it possible for `acquired` to be false? If so then I think the else clause starting at line 2312 below will be incorrect - it expects the thread to be on the entry list which it won't be.
>
> The else clause at line 2312 pairs with `if (state == ObjectWaiter::TS_RUN)` statement, there are only two possibilities, either TS_RUN, or TS_ENTER, the latter implies that the thread is on the `entry_list`.
> 
> If `acquired` is false when handling TS_RUN case, it is fine, the whole method will return false at line 2316.

Sorry misread the code.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27040#discussion_r2708005515


More information about the hotspot-runtime-dev mailing list