https://kotlinlang.org logo
#coroutines
Title
# coroutines
s

SUPERCILEX

03/15/2019, 10:03 PM
Any tips for the kind of breadcrumbs I could be tossing around?
d

Dico

03/16/2019, 2:16 AM
I don't think you're missing any of the stacktrace. Coroutines track the stacktrace and reliable put it back together across thread context switches.
s

SUPERCILEX

03/16/2019, 2:30 AM
But I am
Where was the coroutine called?
The error could have originated from anywhere in my codebase
g

gildor

03/16/2019, 4:49 AM
Maybe you could reproduce it on some simple example
s

SUPERCILEX

03/16/2019, 5:22 AM
I'm not asking for help with this specific issue: I want to get a stacktrace or some kind of breadcrumb of the original network request originating from my app. Where did it come from?
Dunno if that clarifies it? Or maybe I'm missing the big picture?
cc @elizarov
d

Dico

03/16/2019, 7:13 AM
The error did not originate in your code base, as the stacktrace suggests. A timeoutexception was thrown by okio library. What guarantees that it should originate in your code somewhere??? Coroutine stacktraces work well, please have some trust in what's on the screen and stop making a fuss.
1
g

gildor

03/16/2019, 9:31 AM
I agree with Dico, it looks strange that there are no coroutines in stacktrace, this exception was never caught. This is why I asked about some sample that reproduces this problem with coroutines to at least investigate
@SUPERCILEX I understand now your problem, probably you don’t use debug mode of coroutines Such stacktrace is standard thing for async API, you can try do the same with okhttp3.Callback, without wrapping to additional exception or using some sort of logging you will have only such stacktrace
s

SUPERCILEX

03/16/2019, 4:49 PM
@gildor thanks for understanding the problem. So are you saying if I catch the exceptions thrown from my network request and rethrow a wrapped version, it'll have a stacktrace from my codebase?
If I logged stuff, it still wouldn't be helpful AFAIK because multiple async things could start and I wouldn't know which one of them failed.
g

gildor

03/17/2019, 10:40 AM
@SUPERCILEX I updated my OkHttp adapter library README with some examples of how you may debug async exceptions, all those advices may be used not only for OkHttp https://github.com/gildor/kotlin-coroutines-okhttp/blob/master/README.md#debugging If something is not very clear, be free to ask or send PR
s

SUPERCILEX

03/18/2019, 6:08 AM
Thanks for the write up!
4 Views