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

Sentry Native Android SDK Crashing - sentry__string_eq Unhandled Segfault #859

Closed
2 tasks
thinkocapo opened this issue Jun 28, 2023 · 4 comments
Closed
2 tasks
Labels
bug Something isn't working outdated The issue refers to an older version. Platform: Android Platform: Native

Comments

@thinkocapo
Copy link

Description

Message me @will in Slack for link to the Customer's Issue in Sentry.

When does the problem happen

  • During build
  • [ x] During run-time
  • When capturing a hard crash

Environment

Steps To Reproduce
The issue in sentry has this on it:

err.type looks like sentry__string_eq

it also says Unhandled Segfault

and

image

Log output
no additional log output

@will
Copy link

will commented Jun 28, 2023 via email

@supervacuus
Copy link
Collaborator

Hi, thanks for the report. I can gather from the stack trace that this must have been in a sentry-android version that came bundled with sentry-native < 0.6.2. The segfault comes from passing NULL to strcmp() inside sentry__string_eq().

Adding ptr/len interfaces to the API, I rewrote many string functions and specifically added early checks for NULLs. Especially the code in sentry_value_set_by_key() has been made safer. This was released with sentry-android 6.19.0.

@supervacuus supervacuus added bug Something isn't working outdated The issue refers to an older version. and removed Status: Untriaged Waiting for: Product Owner labels Jun 29, 2023
@thinkocapo
Copy link
Author

is the suggestion to upgrade to 6.19.0? If so, what is the the new expected behavior? So I can communicate back to the customer.

For example:

  1. upgrade to 6.19.0
  2. the sdk should not error on itself anymore, therefore no event for sending to Sentry.io.
  3. or
  4. upgrade to 6.19.0
  5. the sdk might still error on itself, but the event will not get sent to Sentry.io? the sdk will fail more silently this time?

@supervacuus
Copy link
Collaborator

I would always recommend upgrading if there seems to be a bug in an SDK because we do not maintain separate release branches, so even if there is still an issue in the latest release, I can only supply a fix on top of that. Going deeper, this stack trace is probably from version 0.4.18 of the Native SDK, released over a year ago (and packaged with sentry-android 6.3.1).

The crash in the Native SDK is probably caused by the same memory corruption which caused the application to crash in the first place. We can make sure that we don't crash in that particular situation. However, the resulting crash event will still be affected by that. The stack trace shows that the segfault occurs when setting the event_id of the crash-event, meaning that either the constant string "event_id" is NULL or that the event internal structure has been corrupted, leaving us to try to iterate over non-existent key/value pairs of a fresh object (which has no entries yet).

What I mean by that: fingers crossed that we can send a halfway decent crash report in that case. Understanding how that situation is possible would be interesting, but I cannot gather that from the stack trace. Maybe @Swatinem can look at the event and check if he sees something relevant.

@ashwoods ashwoods moved this from Needs Discussion to Needs More Information in Mobile & Cross Platform SDK Sep 27, 2023
@kahest kahest closed this as not planned Won't fix, can't repro, duplicate, stale Dec 10, 2024
@github-project-automation github-project-automation bot moved this from Needs More Information to Done in Mobile & Cross Platform SDK Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working outdated The issue refers to an older version. Platform: Android Platform: Native
Projects
Archived in project
Archived in project
Development

No branches or pull requests

4 participants