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

Reviewed-by: rehn, coleenp, eosterlund
This commit is contained in:
Daniel D. Daugherty 2021-12-17 21:24:51 +00:00
parent 8fbe1724e0
commit a5f5d60f25
8 changed files with 207 additions and 23 deletions

View file

@ -659,7 +659,7 @@ ThreadStackTrace::~ThreadStackTrace() {
}
}
void ThreadStackTrace::dump_stack_at_safepoint(int maxDepth) {
void ThreadStackTrace::dump_stack_at_safepoint(int maxDepth, ObjectMonitorsHashtable* table) {
assert(SafepointSynchronize::is_at_safepoint(), "all threads are stopped");
if (_thread->has_last_Java_frame()) {
@ -683,9 +683,19 @@ void ThreadStackTrace::dump_stack_at_safepoint(int maxDepth) {
if (_with_locked_monitors) {
// Iterate inflated monitors and find monitors locked by this thread
// not found in the stack
// that are not found in the stack, e.g. JNI locked monitors:
InflatedMonitorsClosure imc(this);
ObjectSynchronizer::monitors_iterate(&imc, _thread);
if (table != nullptr) {
// Get the ObjectMonitors locked by the target thread, if any,
// and does not include any where owner is set to a stack lock
// address in the target thread:
ObjectMonitorsHashtable::PtrList* list = table->get_entry(_thread);
if (list != nullptr) {
ObjectSynchronizer::monitors_iterate(&imc, list, _thread);
}
} else {
ObjectSynchronizer::monitors_iterate(&imc, _thread);
}
}
}
@ -936,9 +946,10 @@ ThreadSnapshot::~ThreadSnapshot() {
delete _concurrent_locks;
}
void ThreadSnapshot::dump_stack_at_safepoint(int max_depth, bool with_locked_monitors) {
void ThreadSnapshot::dump_stack_at_safepoint(int max_depth, bool with_locked_monitors,
ObjectMonitorsHashtable* table) {
_stack_trace = new ThreadStackTrace(_thread, with_locked_monitors);
_stack_trace->dump_stack_at_safepoint(max_depth);
_stack_trace->dump_stack_at_safepoint(max_depth, table);
}