getsentry / sentry-java

A Sentry SDK for Java, Android and other JVM languages.
https://docs.sentry.io/
MIT License
1.14k stars 432 forks source link

Deobfuscate class/field names in exception messages #942

Open OlivierFreyssinet-old opened 3 years ago

OlivierFreyssinet-old commented 3 years ago

I'm getting a lot of exceptions of this kind:

NullPointerException
Attempt to read from field 'java.util.List f.f.c.j.b.a.t.a.b' on a null object reference

The stacktrace is perfectly deobfuscated and thanks Sentry for that, it's really great! However I was wondering if it's possible to detect obfuscated class names inside error messages.

Right now in order to understand what this error is I have to open the mapping.txt file and manually search for what the f.f.c.j.b.a.t.a.b field is, which I have to do every time I open such an issue on Sentry.

I guess automatically detecting and deobfuscating obfuscated class/field names in such error messages is not as straightforward as deobfuscating the strack trace but maybe when a mapping file is detected, there could be a button like "Deobfuscate message based on mapping file" next to the error message, and it would look for matches between the message string and the mapping file ?

That would be a killer feature!

bruno-garcia commented 3 years ago

Thanks for raising. This came up a few times. We should be prioritizing this eventually.

marandaneto commented 3 years ago

@OlivierFreyssinet just a quick question, could you exemplify how you are capturing those messages?

Are you doing something like Sentry.captureMessage(exeption.getMessage())? just to understand what you'd be expecting to be deobfuscated.

Thanks.

OlivierFreyssinet-old commented 3 years ago

Sure, I'm just doing Sentry.captureException(exception)

marandaneto commented 3 years ago

@OlivierFreyssinet could you link us to a Sentry issue like this so we could have a look at the event? thanks Breadcrumbs and messages are not deobfuscated, but when you do Sentry.captureException(exception), the event's title should be inferred from the already deobfuscated classes, if not, it's a bug.

OlivierFreyssinet-old commented 3 years ago

Here's one: https://sentry.io/organizations/blloc/issues/1630576419/?project=1284943&query=is%3Aunresolved

Edit: Actually it seems like this exception is handled by the UncaughtExceptionHandler, not manually with a Sentry.captureException

romtsn commented 1 year ago

This has been tackled on the product, see this comment https://github.com/getsentry/sentry-java/issues/2406#issuecomment-1381977053. Closing this for now, feel free to reopen/comment if it's still not working for some cases and we'll look into it!

ofreyssinet-ledger commented 1 year ago

Nice! Thanks for the follow up

romtsn commented 1 month ago

Reopening, since this doesn't work anymore after moving deobfuscation to symbolicator

JustinBis commented 2 days ago

Any progress on fixing this again? It's pretty annoying to have to manually deobfuscate issues where an obfuscated class name is in the error message like this:

Image