vineethraj49
04/13/2021, 3:37 AMwithContext(<http://Dispatchers.IO|Dispatchers.IO>)
onto a new thread?
applies to GlobalScope.future(<http://Dispatchers.IO|Dispatchers.IO>)
etc as wellZach Klippenstein (he/him) [MOD]
04/13/2021, 3:45 AMvineethraj49
04/13/2021, 3:52 AMCompletableFuture.get()
DefaultDispatcher-worker-1
.get()
DefaultDispatcher-worker-2
.get()
DefaultDispatcher-worker-3
.get()
DefaultDispatcher-worker-4
.get()
now unfortunately, due to "reasons", these completablefutures are from GlobalScope.future(<http://Dispatchers.IO|Dispatchers.IO>) { }
and none of these can spawn because <http://Dispatchers.IO|Dispatchers.IO>
should not context switch, but because all DefaultDispatcher-workers are blocked, there's a deadlock
there are obviously better and correct-er ways of fixing this; but out of curiosity, if <http://Dispatchers.IO|Dispatchers.IO>
spawn wasn't blocked on Dispatchers.Default
this could probably be avoidedrocketraman
04/13/2021, 4:26 AMCompletableFuture.get()
on the default dispatcher. Use the suspending await
extension for `CompletableFuture`: https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-jdk8/.vineethraj49
04/13/2021, 6:32 AMelizarov
04/13/2021, 9:29 AMvineethraj49
04/13/2021, 10:46 AMrocketraman
04/13/2021, 1:07 PM