8316401: sun/tools/jhsdb/JStackStressTest.java failed with "InternalError: We should have found a thread that owns the anonymous lock"

Reviewed-by: cjplummer, dholmes
This commit is contained in:
Roman Kennke 2023-09-29 11:14:13 +00:00
parent c45308afac
commit bd918f49d2

View File

@ -241,7 +241,11 @@ public class Threads {
return thread;
}
}
throw new InternalError("We should have found a thread that owns the anonymous lock");
// We should have found the owner, however, as the VM could be in any state, including the middle
// of performing GC, it is not always possible to do so. Just return null if we can't locate it.
System.out.println("Warning: We failed to find a thread that owns an anonymous lock. This is likely");
System.out.println("due to the JVM currently running a GC. Locking information may not be accurate.");
return null;
}
// Owner can only be threads at this point.
Address o = monitor.owner();