Skip to content

CoroutinesDump doesn't dump unstarted lazy jobs #1544

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cy6erGn0m opened this issue Sep 17, 2019 · 0 comments
Closed

CoroutinesDump doesn't dump unstarted lazy jobs #1544

cy6erGn0m opened this issue Sep 17, 2019 · 0 comments
Assignees

Comments

@cy6erGn0m
Copy link
Contributor

CoroutinesDump doesn't dump lazy coroutines start are not yet started. This is important since in spite of that they are not yet started, they affect structured jobs completion.

The following example dumps only "blocking-job" while "lazy-job" lurks.

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

    private val parent = Job()
    override val coroutineContext: CoroutineContext = parent

    @BeforeTest
    fun start() {
        launch(CoroutineName("lazy-job"), start = CoroutineStart.LAZY) {
        }
    }

    @AfterTest
    fun cleanup() {
        parent.cancel()
    }

    @Test
    fun test(): Unit = runBlocking(CoroutineName("blocking")) {
        parent.complete()
        parent.join()
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants