Skip to content

fix(android): Reduce SQLite cursor SDK crash false-positives - #5883

Merged
0xadam-brown merged 1 commit into
mainfrom
fix/sqlite-stability-attributions
Aug 4, 2026
Merged

fix(android): Reduce SQLite cursor SDK crash false-positives#5883
0xadam-brown merged 1 commit into
mainfrom
fix/sqlite-stability-attributions

Conversation

@0xadam-brown

@0xadam-brown 0xadam-brown commented Aug 3, 2026

Copy link
Copy Markdown
Member

📜 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

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

#skip-changelog

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>
@sentry

sentry Bot commented Aug 3, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.51.0 (1) release

⚙️ sentry-android Build Distribution Settings

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 281.49 ms 349.14 ms 67.65 ms
Size 0 B 0 B 0 B

Baseline results on branch: main

Startup times

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

@0xadam-brown 0xadam-brown added the sanity-check PR needs a lightweight review for obvious issues label Aug 3, 2026

@runningcode runningcode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know about CursorWrapper Nice find! Are there other place we should apply this to?

@0xadam-brown

Copy link
Copy Markdown
Member Author

I didn't know about CursorWrapper Nice find! Are there other place we should apply this to?

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).

@0xadam-brown
0xadam-brown merged commit 926b414 into main Aug 4, 2026
38 checks passed
@0xadam-brown
0xadam-brown deleted the fix/sqlite-stability-attributions branch August 4, 2026 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sanity-check PR needs a lightweight review for obvious issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants