Repository navigation
fix: Keep handling LinkageError where the SDK expects it (JAVA-552) - #6666
Draft
runningcode wants to merge 4 commits into
Draft
runningcode wants to merge 4 commits into
runningcode wants to merge 4 commits into
Conversation
ExceptionUtils.rethrowIfFatal rethrows LinkageError. At these sites a LinkageError is the expected failure: a native library that failed to load, a missing optional dependency, or a mismatched Compose or androidx version. Each one is narrowed to the types the guarded code throws, or catches LinkageError before a broad catch that calls rethrowIfFatal. The event processor loops in SentryClient handle a LinkageError like any other processor failure. Refs #5513 Refs JAVA-552 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 of 9 tasks
This was referenced Nov 18, 2026
This was referenced Nov 18, 2026
📲 Install BuildsAndroid
|
Refs #5513 Refs JAVA-552 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
ExceptionUtils.rethrowIfFatalrethrowsLinkageError. At the 36catch (Throwable)sites in this PR, aLinkageErroris the expected failure, not a fatal one: a native library that failed to load, a missing optional dependency, or a mismatched Compose or androidx version. Each site keeps handling it, and stops swallowing other fatal errors:LoadClass, the Spotlight probe inSentryOptions, andProfilingServiceLoaderNdkIntegrationand theSentryNdknative library loadAppState, including theAbstractMethodErrorcase from fix: AbstractMethodError when getting Lifecycle #2228Windows.kt,Nodes.ktandComposeViewHierarchyNode, and inSentryComposeHelperLinkageErrorfirst, then callrethrowIfFatalin thecatch (Throwable)and say in a comment why it's broad:Integration.registerinSentry.init, and each integration'sclose()inScopes.closeViewHierarchyEventProcessorandSentryWindowCallbackDebugImagesLoaderSentryContextStorageProviderNodes.ktandComposeViewHierarchyNodeSentrySQLiteDriver.open: androidx.sqlite iscompileOnly, so a mismatched version returns the connection uninstrumented, as before.SentryClienthandle aLinkageErrorlike any other processor failure: an SDK processor is skipped and the event is still sent. Without that, aNoClassDefFoundErrorin one SDK processor would propagate out of every capture call.Mixed sites
These sites need more than one kind of change, so they get their full treatment here:
WindowManagerSpyinWindows.kt: the reflection is narrowed, and the swap of the root views list moves intoswapSafely, a boundary that callsrethrowIfFatal. The swap notifies the root view listeners, so a failing listener no longer leaves the list half swapped.Scopes.close: the catch around the whole shutdown also callsrethrowIfFatal. It encloses the integrationclose()loop, so a fatal error from an integration only propagates once both catches rethrow it.💡 Motivation and Context
This is part of the
catch (Throwable)audit. Without this PR, addingrethrowIfFatalat these sites would crash apps that work today, for example when the NDK library fails to load, whenSentry.initregisters an integration whose optional dependency is missing, or on every touch when the app uses a Compose version that doesn't match. It replaces theLinkageErrorpart of #6562 and #6657.This PR is independent of its siblings and they can merge in any order:
rethrowIfFatalat boundary sitesUserInteractionTeststhread-safe list💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
The changelog entry for the whole set is in #6665.
#skip-changelog
🤖 Generated with Claude Code