fix(android): Reduce SQLite cursor SDK crash false-positives - #5883
Merged
Conversation
Replace Kotlin interface delegation in SentryCrossProcessCursor with Android's CursorWrapper for ordinary Cursor methods. This keeps lazy-query span instrumentation on getCount, onMove, and fillWindow, but avoids generating Sentry-owned methods such as getString for pass-through cursor calls. When app database code throws from those ordinary cursor methods, the stack should now point at Android's cursor wrapper and the underlying SQLite failure instead of making SDK crash detection treat the event as caused by Sentry's SQLite integration. Co-Authored-By: OpenCode <noreply@opencode.ai>
0xadam-brown
requested review from
adinauer,
markushi,
romtsn and
runningcode
as code owners
August 3, 2026 12:15
📲 Install BuildsAndroid
|
Contributor
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0220a5c | 452.20 ms | 479.33 ms | 27.12 ms |
| d15471f | 310.26 ms | 377.04 ms | 66.78 ms |
| bbc35bb | 298.53 ms | 372.17 ms | 73.64 ms |
| b8bd880 | 314.56 ms | 336.50 ms | 21.94 ms |
| 62b579c | 318.48 ms | 367.71 ms | 49.24 ms |
| d8b6ce1 | 314.62 ms | 348.67 ms | 34.05 ms |
| 44472da | 319.72 ms | 351.90 ms | 32.18 ms |
| e59e22a | 368.02 ms | 432.00 ms | 63.98 ms |
| ee747ae | 400.46 ms | 423.61 ms | 23.15 ms |
| 462dea2 | 309.63 ms | 352.22 ms | 42.59 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0220a5c | 0 B | 0 B | 0 B |
| d15471f | 1.58 MiB | 2.13 MiB | 559.54 KiB |
| bbc35bb | 1.58 MiB | 2.12 MiB | 553.01 KiB |
| b8bd880 | 1.58 MiB | 2.29 MiB | 722.92 KiB |
| 62b579c | 0 B | 0 B | 0 B |
| d8b6ce1 | 0 B | 0 B | 0 B |
| 44472da | 0 B | 0 B | 0 B |
| e59e22a | 1.58 MiB | 2.20 MiB | 635.34 KiB |
| ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
| 462dea2 | 0 B | 0 B | 0 B |
runningcode
approved these changes
Aug 4, 2026
runningcode
left a comment
Contributor
There was a problem hiding this comment.
I didn't know about CursorWrapper Nice find! Are there other place we should apply this to?
Member
Author
This is the only spot. The other SQLite wrappers don't have a framework Wrapper equivalent, so we're out of luck as far as this trick is concerned. The bigger false-positive volume is on instrumented OpenHelper/Database paths, which need SDKCD ignore rules rather than another wrapper change. I've created a branch for that (link), but I'm reluctant to do anything about it because we need to rely on a heuristic that risks suppressing real crashes triggered by us (eg, a Sentry wrapper reuses a closed statement or cursor). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
PR helps us avoid incorrectly attributing host app SQLite crashes to the Sentry SDK in situations where a pass-through cursor method shows up in the crash stack trace.
In particular, it replaces Kotlin interface delegation in SentryCrossProcessCursor in favor of Android's CursorWrapper. That keeps lazy-query span instrumentation on getCount, onMove, and fillWindow, but avoids generating Sentry-owned methods like getString for pass-through cursor calls.
💡 Motivation and Context
Reduces false-positive crash rates associated with the Sentry Android SDK. Something we saw a lot of in 8.44.1 and 8.43.3, as mentioned here.
💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
#skip-changelog