Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I use 'kotlinx-coroutines-debug' in production? #1188

Closed
renannprado opened this issue May 14, 2019 · 5 comments
Closed

Can I use 'kotlinx-coroutines-debug' in production? #1188

renannprado opened this issue May 14, 2019 · 5 comments
Labels

Comments

@renannprado
Copy link

I just came across the issue that my stacktraces are "incorrect" while using coroutines and I found the documentation about the debug agent, but at the end of the page it's written

API is purely experimental and it is not guaranteed that it won't be changed (while it is marked as @ExperimentalCoroutinesApi). Do not use this module in production environment and do not rely on the format of the data produced by DebugProbes.

I just would like to know if this is really only about the API of if that also include using stacktrace recovery in prod.

https://github.com/Kotlin/kotlinx.coroutines/tree/1.2.1/kotlinx-coroutines-debug

@qwwdfsad
Copy link
Collaborator

Stacktrace recovery can be enabled without debug module: https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/debugging.md#debug-mode

Is it enough for your use-case?

@renannprado
Copy link
Author

Stacktrace recovery can be enabled without debug module

@qwwdfsad So do you mean that, without the debug module, I would have what is in the Without recovery column?

I'm sorry but I don't understand how can I enable it without the debug module. What do I have to do to do that?

@elizarov
Copy link
Contributor

elizarov commented May 20, 2019

Please see https://github.com/Kotlin/kotlinx.coroutines/blob/master/docs/debugging.md for reference. In short:

  • Debug mode does not need debug agent and can be used in production. It includes stack-trace recovery.
  • Debug agent adds additional features on top of that.

Does it answer your question? Do you really need additional features debug agent brings?

@renannprado
Copy link
Author

@elizarov yes it does. I got confused for some reason, but as I understand I can simply enable the stackstrace recovery with DEBUG_PROPERTY_NAME. My initial concern was the performance impact of the stacktrace recovery, but it doesn't seem to be an issue.

@nehme-bilal-ah
Copy link

Just a follow-up question, I am trying this feature but it doesn't seem to work. I am particularly interested in stacktrace recovery, which if I understand correctly should exceptions thrown from coroutines to be logged with full stacktrace?

I tried to enable this feature as follows by installing org.jetbrains.kotlinx:kotlinx-coroutines-debug package and enabling debug mode as follows:

    System.setProperty(
        kotlinx.coroutines.DEBUG_PROPERTY_NAME,
        kotlinx.coroutines.DEBUG_PROPERTY_VALUE_ON
    )

However, it doesn't seem to have any effects on stacktraces, which are still only showing only the stacktrace of the inner most coroutine. Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants