I have: ```private suspend fun awaitX(arg1: String...
# coroutines
w
I have:
Copy code
private suspend fun awaitX(arg1: String): X? = suspendCancellableCoroutine { 
    functionThatExecutesCallback{ result -> println("test"); it.resume(result) }
}
and for some reason, the function that calls this never resumes execution even though
test
does get printed. Any obvious ideas as to what to check? IntelliJ isn't showing the Coroutine debugger tab so I'm somewhat limited to debugging by printing...
z
Is the job cancelled for some reason before you resume? Which dispatcher are you using?
w
No, definitely not cancelled. Dispatcher is Dispatchers.IO
z
Any chance the IO pool is saturated? Just throwing out guesses. I would probably start debugging into the coroutines code itself at this point
w
It turns out the issue was a
runBlocking
inside
functionThatExecutesCallback
that launched a separate coroutine that never finished. I'm not sure this is strictly intuitive behaviour but at the same time I'm not persuaded it's definitely wrong.
z
This is why runBlocking is generally considered Very Bad. One perfectly innocent little use and suddenly you’ve got a deadlock in code a mile away