Repository navigation
fix(replay): [Throwable Boundaries 3] Rethrow fatal errors at replay, NDK and SQLite boundaries - #6659
Closed
runningcode wants to merge 2 commits into
Closed
fix(replay): [Throwable Boundaries 3] Rethrow fatal errors at replay, NDK and SQLite boundaries#6659runningcode wants to merge 2 commits into
runningcode wants to merge 2 commits into
Conversation
The remaining catch (Throwable) sites in sentry-android-replay, sentry-android-ndk and sentry-android-sqlite guard the device's graphics and media stacks, the app's own views and ReplayFrameObserver, or reflective serialization of breadcrumb data. Keep them broad, but call ExceptionUtils.rethrowIfFatal first and say at each catch why it's broad and what is lost on failure. - SentrySQLiteDriver.open catches LinkageError first, since androidx.sqlite is compileOnly and a mismatched version is an expected failure. - BaseCaptureStrategy's inline persistence only writes the segment file, so it now catches IOException and IndexOutOfBoundsException. - CanvasStrategy.postSafely checks the result of Handler.post, which returns false instead of throwing. - ReplayFrameObserver documents what happens when it throws. Refs JAVA-552 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SentryNdk.init and close wrap an InterruptedException from waiting on the native library load in an IllegalStateException, and the interrupt was lost. Restore the flag before wrapping, since the SDK doesn't own the calling thread. Refs JAVA-552 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 of 9 tasks
This was referenced Nov 18, 2026
5 of 9 tasks
📲 Install BuildsAndroid
|
4 of 9 tasks
This was referenced Nov 18, 2026
Contributor
Author
|
Replaced by independent PRs against |
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.
PR Stack (Throwable Boundaries)
📜 Description
This PR handles the 16 remaining swallowing
catch (Throwable)sites insentry-android-replay,sentry-android-ndkandsentry-android-sqlite, and fixes a lost interrupt inSentryNdk:ExceptionUtils.rethrowIfFatalfirst, with a comment saying why the catch is broad and what is lost when it fails. They guard the device's graphics and media stacks (PixelCopy, canvas drawing,MediaCodec), the app's own views and touch dispatch,ReplayFrameObserver, the replay executors' task wrappers, and the reflective serialization of breadcrumb data for the NDK.LinkageErrorarm (1):SentrySQLiteDriver.open. androidx.sqlite iscompileOnly, so a mismatched version returns the connection uninstrumented, as before.BaseCaptureStrategy's inline segment persistence:IOException, andIndexOutOfBoundsExceptionfor a corrupt segment file line.CanvasStrategy.postSafely:Handler.postdoesn't throw. It returnsfalsewhen the looper is quitting, so it now logs onfalseinstead.SentryReplayOptions.ReplayFrameObserver.onMaskedFrameCapturedsays what happens when the observer throws.SentryNdk.initandclosenow restore the thread's interrupt flag before wrapping anInterruptedExceptionin anIllegalStateException.💡 Motivation and Context
This is the replay, NDK and SQLite part of the
rethrowIfFatalboundary pass. Note that anOutOfMemoryErrorwhile capturing a frame, for example fromBitmap.createBitmap, now propagates instead of only skipping the frame. In the replay executors, a fatal error ends the task rather than being logged.💚 How did you test it?
sentry-android-replay,sentry-android-ndkandsentry-android-sqlite, plus detekt for the Kotlin modules.IOException; the SQLite driver returns the uninstrumented connection on aLinkageErrorand rethrows anOutOfMemoryError;SentryNdk.initandclosekeep the interrupt.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
#skip-changelog
🤖 Generated with Claude Code