Skip to content

Robolectric tests froze forever after upgrade to 1.6.0, because of delay inside Dispatcher.IO #3211

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
neworld opened this issue Mar 3, 2022 · 3 comments

Comments

@neworld
Copy link

neworld commented Mar 3, 2022

This code works totally fine on vanilla junit tests, or in <1.6.0 versions of coroutines, but it stuck forever in RobolectricTestRunner after upgrade to 1.6.0:

@Test
fun foo() = runBlocking {
    withContext(Dispatchers.IO) {
        println("before delay")
        delay(1000) // <------ here stuck forever
        println("after delay")
    }
}

Test dispatchers also work OK. Is it intended? If not, I can create a full project if it helps you to fix the bug. My case is similar to #1365

@dkhalanskyjb
Copy link
Collaborator

Could you try setting the kotlinx.coroutines.main.delay system property to false? This looks like an issue with the same root cause as #3173.

@neworld
Copy link
Author

neworld commented Mar 9, 2022

Thanks, @dkhalanskyjb. It works. I am closing this in favor of having one issue: #3173

@neworld neworld closed this as completed Mar 9, 2022
@pacher
Copy link

pacher commented Mar 11, 2022

This issue keeps popping up, I counted already five.
@qwwdfsad Maybe you can consider if anyhow possible to make a minor release where the delay change is reverted?
Last coroutines release was almost three month ago.

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

3 participants