[jdk18] RFR: 8273107: RunThese24H times out with "java.lang.management.ThreadInfo.getLockName()" is null

Robbin Ehn rehn at openjdk.java.net
Thu Dec 16 07:30:00 UTC 2021


On Wed, 15 Dec 2021 22:26:47 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> Sounds like an interesting RFE, but I'd prefer that be investigated
>> separately from this bug.
>
> Clarification: ThreadStackTrace::is_owned_monitor_on_stack() is not actually
> walking the (JavaThread's) stack, but it is walking the collection of
> StackFrameInfo objects that was gathered earlier in
> ThreadStackTrace::dump_stack_at_safepoint(). Adding a gather-locked-monitor
> helper object to the "add_stack_frame()" call would provide an easy hook and
> then InflatedMonitorsClosure could use the new helper object. Something like
> that anyway...

Yes, sorry, we loop the stack frame info for every object. I.e. a loop in a loop which  is bad for time-complexity.
If the we created a sorted list from the frame info, we can binary search it instead.
Since a thread often only have at max a few locks, but could have hundreds of frames, just to be able skip looping over all frames without locks would be very beneficial.

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

PR: https://git.openjdk.java.net/jdk18/pull/25


More information about the hotspot-runtime-dev mailing list