jeggy
06/17/2020, 10:29 AMfun main() = runBlocking {
repeat(50) {
launch(<http://Dispatchers.IO|Dispatchers.IO>) {
delay(5000L * it)
println("Done $it")
}
}
}
Having some code like this. Is it possible to leak coroutines, if I were to just send the kill signal to this process?spand
06/17/2020, 10:41 AMZach Klippenstein (he/him) [MOD]
06/17/2020, 12:38 PMjeggy
06/17/2020, 1:39 PM@Test
fun threads() = runBlockingTest {
(1..50).map {
launch(<http://Dispatchers.IO|Dispatchers.IO>) {
delay(5000L * it)
println("Done $it")
}
}.joinAll()
}
The test will fail, so just wanted to be sure if that wasn't leaked anywhere.
To ask a new question, what's the reason for that specific test failing?uli
06/17/2020, 2:17 PMjeggy
06/17/2020, 3:06 PMjava.lang.IllegalStateException: This job has not completed yet
tseisel
06/17/2020, 6:11 PMrunBlockingTest
, it seems that using another dispatcher conflicts with the auto-advancing time feature. You may reproduce the same problem with withContext