Fix CoronerSpec instability (#30494)

Tested in https://github.com/akka/akka/pull/30437 that indeed looking at
the threads 'too soon' might miss the deadlock.
This commit is contained in:
Arnout Engelen 2021-08-06 14:24:28 +02:00 committed by GitHub
parent 6e0158e221
commit 5ecd26d369
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -144,6 +144,11 @@ object Coroner {
#Heap usage: ${memMx.getHeapMemoryUsage()}
#Non-heap usage: ${memMx.getNonHeapMemoryUsage()}""".stripMargin('#'))
// If we look too soon, we've seen the JVM report a thread
// (in that case deadlock-thread-a from CoronerSpec)
// waiting on the lock while no thread seemed to be holding it
Thread.sleep(300)
def dumpAllThreads: Seq[ThreadInfo] =
threadMx.dumpAllThreads(threadMx.isObjectMonitorUsageSupported, threadMx.isSynchronizerUsageSupported).toSeq