RFR: 8274794: Print all owned locks in hs_err file

Coleen Phillimore coleenp at openjdk.java.net
Fri Oct 15 16:28:49 UTC 2021


On Thu, 14 Oct 2021 20:51:44 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> See CR for details.  This saves the created mutex in a mutex_array during Mutex construction so that all Mutex, not just the ones in mutexLocker.cpp can be printed in the hs_err file.  ThreadCritical is used to protect the mutex_array, and to avoid UB should be used when printing the owned locks, but since that is done during error handling, this seemed better not to lock during error handling.  There's 0 probability that another thread will be creating a lock during this error handling anyway.
> Tested with tier1-8.

The new printing in the error file looks like this.  I'm not sure if it'll be confusing to see how many mutexes have been created, or maybe the message should be reworded somewhat?

VM Mutex/Monitor currently owned by a thread:
[0x0000146688024e00] Threads_lock - owner thread: 0x00001466880283c0 allow_vm_block safepoint-1
Total Mutex count 580

The allow_vm_block and safepoint-1 are NOT printed in PRODUCT mode.

I took out this because I don't know what it's trying to say and it doesn't seem meaningful:
          // print format used by Mutex::print_on_error()
          st->print_cr(" ([mutex/lock_event])");

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

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


More information about the hotspot-dev mailing list