Skip to content
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

CoroutinesTimeout non-coroutines jobs dump #1543

Open
cy6erGn0m opened this issue Sep 17, 2019 · 4 comments
Open

CoroutinesTimeout non-coroutines jobs dump #1543

cy6erGn0m opened this issue Sep 17, 2019 · 4 comments

Comments

@cy6erGn0m
Copy link
Contributor

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()
    }
}
@qwwdfsad
Copy link
Member

I wonder how to represent that.
Do you expect to see a creation stacktraces of these jobs (implying corresponding overhead unless #1379 is here)? Because otherwise, it might not be that useful.
Do you want it to see only in tests or during the regular debugging/production uses as well?

How should things like this be represented both in the dump and programmatically?

launch {
    val job1 = Job(coroutineContext[Job])
    val job2 = Job(job2)
}

Should we nest stacktraces in that case? Or should we print them similarly to printJob, but for all the active jobs?

@elizarov
Copy link
Contributor

IMO, capturing creation stack-trace for them in the debug mode seems to be Ok.

@cy6erGn0m
Copy link
Contributor Author

I believe it is useful in both tests and debugging. Since there is no way to pass a coroutine name to Job() invocation, it seems that we need a stack-trace.

@cy6erGn0m
Copy link
Contributor Author

Don't think we need to nest stack-traces since it will complicate reading. Jobs tree and stack-traces below could be a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants