RFR: 8316735: Print LockStack in hs_err files

David Holmes dholmes at openjdk.org
Mon Sep 25 01:25:11 UTC 2023


On Fri, 22 Sep 2023 09:47:22 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

> Example output:
> 
> Objects fast locked by this thread (top to bottom):
> LockStack[1]: nsk.share.jdi.EventHandler 
> {0x00000000bcc28198} - klass: 'nsk/share/jdi/EventHandler'
>  - ---- fields (total size 5 words):
>  - private volatile 'wasInterrupted' 'Z' @12  false (0x00)
>  - private 'debuggee' 'Lnsk/share/jdi/Debugee;' @16  a 'nsk/share/jdi/LocalLaunchedDebugee'{0x00000000bcc08c18} (0xbcc08c18)
>  - private 'log' 'Lnsk/share/Log;' @20  a 'nsk/share/Log'{0x00000000bcc08cb0} (0xbcc08cb0)
>  - private 'vm' 'Lcom/sun/jdi/VirtualMachine;' @24  a 'com/sun/tools/jdi/VirtualMachineImpl'{0x00000000bccb3d60} (0xbccb3d60)
>  - private 'requestManager' 'Lcom/sun/jdi/request/EventRequestManager;' @28  a 'com/sun/tools/jdi/EventRequestManagerImpl'{0x00000000bccb56f8} (0xbccb56f8)
>  - private 'listenThread' 'Ljava/lang/Thread;' @32  a 'java/lang/Thread'{0x00000000bcc280e8} (0xbcc280e8)
> LockStack[0]: java.util.Collections$SynchronizedRandomAccessList 
> {0x00000000bcb163e8} - klass: 'java/util/Collections$SynchronizedRandomAccessList'
>  - ---- fields (total size 3 words):
>  - final 'c' 'Ljava/util/Collection;' @12  a 'java/util/Vector'{0x00000000bcb16400} (0xbcb16400)
>  - final 'mutex' 'Ljava/lang/Object;' @16  a 'java/util/Collections$SynchronizedRandomAccessList'{0x00000000bcb163e8} (0xbcb163e8)
>  - final 'list' 'Ljava/util/List;' @20  a 'java/util/Vector'{0x00000000bcb16400} (0xbcb16400)

Yes it is a good idea to have this. Potentially we may want it for thread dumps too (separate RFE fine).

Thanks

src/hotspot/share/runtime/lockStack.hpp line 33:

> 31: #include "utilities/sizes.hpp"
> 32: 
> 33: class JavaThread;

Seems an unrelated change.

src/hotspot/share/utilities/vmError.cpp line 1173:

> 1171:     st->print_cr("Objects fast locked by this thread (top to bottom):");
> 1172:     JavaThread::cast(_thread)->lock_stack().print_on(st);
> 1173: 

I would have expected this to be printed along with the other current thread info.

"fast locked" is not terminology we are using for this any more IIUC. I would suggest just saying this is the lock stack for the thread.

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

Changes requested by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/15884#pullrequestreview-1641190833
PR Review Comment: https://git.openjdk.org/jdk/pull/15884#discussion_r1335294178
PR Review Comment: https://git.openjdk.org/jdk/pull/15884#discussion_r1335295956


More information about the hotspot-dev mailing list