RFR: 8273608: Deadlock when jcmd of OnError attaches to itself [v2]

David Holmes dholmes at openjdk.java.net
Wed Sep 29 04:59:50 UTC 2021


On Wed, 29 Sep 2021 04:38:59 GMT, Xin Liu <xliu at openjdk.org> wrote:

>> src/hotspot/share/runtime/mutexLocker.cpp line 390:
>> 
>>> 388:     owned_lock = next;
>>> 389:   }
>>> 390: #endif // ASSERT
>> 
>> Should we also clear `_owned_locks` after this so that it is still correct?
>
> In debug build, Thread keeps tracks its owning mutexes and Mutex keeps tracks its owner. 
> eg. Mutex::unlock() -> Mutex::set_owner(NULL) -> Mutex::set_owner_implementation(NULL). 
> 
> here it deletes owned_lock from its owner.  
> https://github.com/openjdk/jdk/blob/master/src/hotspot/share/runtime/mutex.cpp#L483

Thanks - I missed that housekeeping.

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

PR: https://git.openjdk.java.net/jdk/pull/5590


More information about the hotspot-dev mailing list