Skip to content

fix: [Throwable Boundaries 4] Rethrow fatal errors at JVM integration boundaries - #6660

Closed
runningcode wants to merge 1 commit into
no/java-552-boundaries-replay-ndkfrom
no/java-552-boundaries-jvm
Closed

runningcode wants to merge 1 commit into
no/java-552-boundaries-replay-ndkfrom
no/java-552-boundaries-jvm

Conversation

@runningcode

@runningcode runningcode commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

PR Stack (Throwable Boundaries)


📜 Description

This PR handles the 28 remaining swallowing catch (Throwable) sites in the JVM integrations: sentry-apollo-3, sentry-apollo-4, sentry-kafka, sentry-logback, sentry-quartz, sentry-spotlight, sentry-spring, sentry-spring-jakarta and sentry-spring-7.

  • 27 boundaries now call ExceptionUtils.rethrowIfFatal first, with a comment saying why the catch is broad and what is lost when it fails:
    • Apollo 3 and 4 (3 each): the beforeSpan callback, the request body's writeTo (the app's upload code, left for this pass by ref: Narrow Throwable catches to the exceptions they guard (JAVA-552) #6564), and the failed-request event.
    • Kafka (5): consumer scope fork, start and finish; producer callback status and header injection.
    • Logback (1): the encoder.
    • Quartz (2): jobToBeExecuted and jobWasExecuted.
    • Spotlight (1): envelope serialization.
    • Spring, Spring Jakarta and Spring 7 (4 each, identical): the check-in slug resolver, the Kafka record interceptor, the session cookie extraction and configureScope.
  • Unchanged (1): SentryKafkaConsumerTracing's catch (Throwable t) { throwUnchecked(t); } already rethrows everything.
  • Javadoc on the user-facing hooks says what happens when they throw, that fatal errors are rethrown, and where the failure is logged:
    • BeforeSpanCallback.execute in Apollo 3 and 4
    • SentryAppender.setEncoder
    • SentryCheckIn.value in the three Spring modules

No catch needed a LinkageError arm. The calls they guard use the same framework APIs as the code outside them, so a mismatched version fails before reaching them.

💡 Motivation and Context

This is the JVM integrations part of the rethrowIfFatal boundary pass.

💚 How did you test it?

  • The unit tests of the changed classes in each module, plus detekt for Apollo 3 and 4. The Spring check-in advice tests fail locally on main too, so CI covers them.
  • New tests check that an OutOfMemoryError propagates from the Apollo 3 and 4 beforeSpan callbacks and from the Logback encoder.

📝 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

⚠️ Merge this PR using a merge commit (not squash). Only the bottom of the stack, #6562, is squash-merged into 9.x.x.

#skip-changelog

🤖 Generated with Claude Code

The broad catches in the Apollo, Kafka, Logback, Quartz, Spotlight and
Spring integrations swallowed every Throwable, including OutOfMemoryError
and StackOverflowError. Each now calls ExceptionUtils.rethrowIfFatal
first and says why it is broad and what happens on failure.

None of them needs a LinkageError arm: the calls into the framework
outside these catches need the same APIs, so a mismatched version fails
before them.

The user-facing callbacks and options these catches wrap say how a
failure shows up: Apollo's BeforeSpanCallback, SentryAppender's encoder,
and the slug of @SentryCheckIn.

Refs JAVA-552

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Nov 18, 2026

Copy link
Copy Markdown

JAVA-552

@sentry

sentry Bot commented Nov 18, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 18, 2026
@runningcode

Copy link
Copy Markdown
Contributor Author

Replaced by independent PRs against 9.x.x, one per kind of change (JAVA-552). This PR's JVM integration boundaries and their Javadoc are now in #6665.

@runningcode
runningcode deleted the no/java-552-boundaries-jvm branch November 18, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant