[rdct-tests] add troubleshooting coroutine dump

GitOrigin-RevId: f72c0092ffdbf81a5c4f53870fa9c6e6b48e7877
This commit is contained in:
Anastasia Katsman
2024-12-16 13:57:24 +01:00
committed by intellij-monorepo-bot
parent 557ea312a0
commit 845d1ddf90

View File

@@ -5,6 +5,7 @@ import com.intellij.codeWithMe.ClientId.Companion.isLocal
import com.intellij.codeWithMe.asContextElement
import com.intellij.codeWithMe.clientId
import com.intellij.diagnostic.LoadingState
import com.intellij.diagnostic.dumpCoroutines
import com.intellij.diagnostic.enableCoroutineDump
import com.intellij.diagnostic.logs.DebugLogLevel
import com.intellij.diagnostic.logs.LogCategory
@@ -108,9 +109,14 @@ open class DistributedTestHost(coroutineScope: CoroutineScope) {
if (port != null) {
LOG.info("Queue creating protocol on $hostAddress:$port")
coroutineScope.launch {
val coroutineDumperOnTimeout = launch {
delay(20.seconds)
LOG.warn("LoadingState.COMPONENTS_LOADED has not occurred in 20 seconds: ${dumpCoroutines()}")
}
while (!LoadingState.COMPONENTS_LOADED.isOccurred) {
delay(10.milliseconds)
}
coroutineDumperOnTimeout.cancel()
withContext(Dispatchers.EDT + ModalityState.any().asContextElement()) {
createProtocol(hostAddress, port)
}