RFR: 8366659: ObjectMonitor::wait() can deadlock with a suspension request [v6]

Daniel D. Daugherty dcubed at openjdk.org
Wed Nov 12 17:17:19 UTC 2025


On Tue, 11 Nov 2025 12:05:10 GMT, Anton Artemov <aartemov at openjdk.org> wrote:

>> Same question from me. :)
>
> This assert only works in a non-blocked state. The call to `reenter_internal` is now done in a blocked state, I also changed the assertion on the state from `!=` to `==` a few lines above this line. 
> 
> `assert_mark_word_consistency()` calls `object()` which calls `check_object_context()`, which can pass only if the state is either `_thread_in_vm` or `_thread_in_Java`. Since the call is now made from a blocked state, the assert has to be removed. 
> 
> `assert_mark_word_consistency()` is called after the thread is back to a non-blocked state.

Thanks for the explanation!

Please add a comment above line 341:


// Can only be called from _thread_in_vm or _thread_in_Java due to object() call:
341: #define assert_mark_word_consistency()                                         \
342:   assert(UseObjectMonitorTable || object()->mark() == markWord::encode(this),  \

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

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


More information about the serviceability-dev mailing list