Kotlin/kotlinx.coroutines

CoroutinesTimeout non-coroutines jobs dump

Ouverte

#1 543 ouverte le 17 sept. 2019

 (4 commentaires) (0 réaction) (1 personne assignée)Kotlin (1 927 forks)batch import
debugenhancementhelp wanted

Métriques du dépôt

Stars
 (13 749 étoiles)
Métriques de merge PR
 (Merge moyen 130j 3h) (4 PRs mergées en 30 j)

Description

It would be convenient to see non-coroutines incomplete Job instances in coroutines dumps as well. It will improve structured jobs analysis in the case when a Job (or CompletableDeferred) prevents a parent from completion.

The following example test hangs because of a job and a completable deferred, but the coroutines dump doesn't provide enough information, so it's not that easy to backtrace the reason.

class DumpTest {
    @get:Rule
    val timeout: CoroutinesTimeout = CoroutinesTimeout.seconds(1)

    private val parent = Job()

    @BeforeTest
    fun start() {
        Job(parent)
        CompletableDeferred<Unit>(parent)
    }

    @Test
    fun test(): Unit = runBlocking(CoroutineName("blocking")) {
        parent.complete()
        parent.join()
    }
}

Guide contributeur