RFR: 8295849: Consolidate Threads::owning_thread* [v2]

Roman Kennke rkennke at openjdk.org
Thu Oct 27 10:58:13 UTC 2022


On Wed, 26 Oct 2022 19:05:50 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix has_owner() condition
>
> src/hotspot/share/runtime/objectMonitor.inline.hpp line 62:
> 
>> 60:   void* owner = owner_raw();
>> 61:   return owner != NULL || owner == DEFLATER_MARKER;
>> 62: }
> 
> Why does has_owner() return `true` when `owner == DEFLATER_MARKER`?
> I'm only seeing one caller to the new `has_owner()` function in
> `ThreadService::find_deadlocks_at_safepoint()` and I don't understand why
> that code needs to think `has_owner()` needs to be `true` if the target
> ObjectMonitor is being deflated.
> 
> That new `has_owner()` call will result in calling `Threads::owning_thread_from_monitor()`
> with `waitingToLockMonitor` which is being deflated. So the return from
> `Threads::owning_thread_from_monitor()` will be `NULL` which will result
> in us taking the `num_deadlocks++` code path. If I'm reading this right, then
> we'll report a deflating monitor as being in a deadlock. What am I missing here?

Right, good catch. I got the condition the wrong way. I just pushed a fix.

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

PR: https://git.openjdk.org/jdk/pull/10849


More information about the serviceability-dev mailing list