Skip to content

Puzzling hang in runBlocking #835

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
elizarov opened this issue Nov 14, 2018 · 1 comment
Closed

Puzzling hang in runBlocking #835

elizarov opened this issue Nov 14, 2018 · 1 comment
Assignees
Labels

Comments

@elizarov
Copy link
Contributor

elizarov commented Nov 14, 2018

From @konrad-kaminski

This code hangs, but does not hang without invokeOnCompletion:

fun main() {
    runBlocking {
        val job = GlobalScope.launch {  }
        job.invokeOnCompletion {  }
    }
}

Initial investigation shows that it is timing-depended, e.g. adding println statements inside runBlocking before } affects whether it hangs or not, too.

@qwwdfsad qwwdfsad changed the title Puzzling timing-depended hand in runBlocking Puzzling timing-depended hang in runBlocking Nov 14, 2018
@qwwdfsad qwwdfsad added the bug label Nov 14, 2018
@qwwdfsad qwwdfsad self-assigned this Nov 14, 2018
@qwwdfsad
Copy link
Collaborator

qwwdfsad commented Nov 14, 2018

Single-threaded reproducer:

runBlocking {
  coroutineContext[Job]!!.invokeOnCompletion {  }
}

@elizarov elizarov changed the title Puzzling timing-depended hang in runBlocking Puzzling hang in runBlocking Nov 14, 2018
qwwdfsad added a commit that referenced this issue Nov 14, 2018
…y) because otherwise job machinery treats such state as intermediate

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

No branches or pull requests

2 participants