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

Get rid of backspace symbol in artificial stackframe for stacktrace recovery #2291

Closed
qwwdfsad opened this issue Oct 8, 2020 · 2 comments
Closed

Comments

@qwwdfsad
Copy link
Contributor

qwwdfsad commented Oct 8, 2020

For the sake of IDE-friendliness, we are using backspace symbol \b in our stacktrace recovery machinery.

This trick is helpful to render a StackTraceElement as a raw string without line-numbers and parentheses that are obligatory for StackTraceElement.toString implementation.

While initially it was an acceptable solution, time moves on and debug mode is now frequently used in production environments, even by IntelliJ IDEA and its derivatives.
For that, \b solution is no longer desirable: it clutters log files, obfuscates programmatic exception handling and even triggers crashes of third-party tools that do not escape special symbols (that have to be escaped) in exception frames.

Solution

The solution is to get rid of \b, introduce properly documented artificial function to kotlinx.coroutines and make intermediate stackframe reference this function instead.
While it may be inconvenient for first-time users, it should be okay to once navigate to it in IDEA or to read its documentation to get used to it.

Known issues

Flank/flank#764
https://youtrack.jetbrains.com/issue/RIDER-52026

@dkhalanskyjb
Copy link
Collaborator

dkhalanskyjb commented May 12, 2021

It turns out that the coroutine debugger in IDEA would be slightly broken were we to release this change: #2694 (comment). Because of this, we will revert #2461 (via #2695) for the 1.5 release.

After the coroutine debugger is modified to accommodate such a change, we will need to wait for long enough to ensure that the supported versions of the Kotlin plugin are not affected by this. Then, we will be able to safely introduce the change.

@qwwdfsad
Copy link
Contributor Author

Here are the commits:

JetBrains/intellij-community@fd29488
https://jetbrains.team/p/ij/repositories/intellij/revision/657936acb69fbbc59a88e1b7e799f49e81d9f162

They cover all supported IDEA versions, so it's good to go.

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

No branches or pull requests

2 participants