Still confused with coroutine stacktraces sometime...
# coroutines
c
Still confused with coroutine stacktraces sometimes. In this case, I have a compose app with a button onClick where I call a network function from a 3rd party called "supabase" (kinda like firebase). The stacktrace doesn't go back to my composable/app code at all. Which has me severely confused. I talked with the author of the library and he suggested that it's likely something he could address but after opening up a bug, he said that this seems to be a limitation of coroutines. https://github.com/supabase-community/supabase-kt/issues/926#issuecomment-2863743471 Anyone have any clue how I can help myself out with coroutine stacktraces in circumstances like this?
k
Beat me to it
😄 1
c
Stacktrace recovery is another useful feature of debug mode. It is enabled by default in the debug mode, but can be separately disabled by setting kotlinx.coroutines.stacktrace.recovery system property to false.
Hm. I was in debug mode in my android app. I wonder if i need to set something explicitly there.
j
Not sure which debug mode you mean, but this piece of the docs talks about the coroutines debug mode (enabled via
kotlinx.coroutines.debug
system property, or by using the
-ea
JVM flag)
But stacktrace recovery is not enough to get the origin of a coroutine like you seem to want with your
onClick
+
launch
. For this, you need the kotlinx-coroutines-debug agent with
enableCreationStackTraces
c
thank you color 1
k
Maybe Stacktrace Decoroutiner could help here? It’s linked above, but based on their readme it looks like it should work on Android
👍🏼 1
c
thoroughly confused... 😅 Looks like I have some reading to do! thanks all for the info. hopefully i can put together a tldr in a bit