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

David Holmes dholmes at openjdk.java.net
Wed Sep 29 05:38:34 UTC 2021


On Wed, 29 Sep 2021 05:15:27 GMT, Xin Liu <xliu at openjdk.org> wrote:

>> src/hotspot/share/runtime/mutexLocker.hpp line 175:
>> 
>>> 173: // by fatal error handler.
>>> 174: void print_owned_locks_on_error(outputStream* st);
>>> 175: void unlock_locks_owned_by(Thread* t);
>> 
>> // Unlock all Mutex/Monitors currently owned by a JavaThread when executing
>> // `OnError` actions.
>> void unlock_locks_on_error(JavaThread t);
>
> Okay. I will remove `thread->is_Watcher_thread()`.  I keep it for `prepare_for_emergency_dump`
> I think the logic fits all general Thread. Can I keep `unlock_locks_on_error(Thread* t);`

The only time we need an unlock-all-mutexes function is for a JavaThread in the error handling code when we need to transition to native. This is not general purpose code and we shouldn't make it look like it is.

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

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


More information about the hotspot-dev mailing list