rocketraman
09/10/2019, 4:36 PMfun main() {
runBlocking {
throw Exception("e")
}
}
I see the expected stack with the main.runBlocking
call in the stack. However, if I change the dispatcher to explicitly specify Dispatchers.Default
e.g. runBlocking(Dispatchers.Default)
, then all I see is the BaseContinuationImpl.resumeWith
in the stack, and the resume point. This is doubly weird, because I thought Dispatchers.Default
was... well, the default.octylFractal
09/10/2019, 5:52 PMoctylFractal
09/10/2019, 5:52 PMrocketraman
09/10/2019, 5:57 PMrunBlocking
. The docs [1] are not clear about that, but ok. It still doesn't explain the behaviour I'm seeing (basically that means exception stack recovery isn't working even in cases where I thought it was).
[1] In https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/run-blocking.html
The default CoroutineDispatcher for this builder is an internal implementation of event loop that processes continuations in this blocked thread until the completion of this coroutine.and in https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html:
Dispatchers.Default – is used by all standard builder if no dispatcher nor any other ContinuationInterceptor is specified in their context.
rocketraman
09/10/2019, 6:10 PMOverhead of this feature is negligible and it can be safely turned on by default to simplify logging and diagnostic.Are people generally running with debug mode on in production? Why isn't this enabled by default?
octylFractal
09/10/2019, 6:19 PMrocketraman
09/10/2019, 6:28 PMrocketraman
09/10/2019, 6:34 PMoctylFractal
09/10/2019, 6:40 PMrocketraman
09/10/2019, 6:44 PM