Skip to content

fix(core): Preserve both ends of stack traces - #6623

Merged
adinauer merged 4 commits into
9.x.xfrom
feat/4818-stack-overflow-truncation
Nov 20, 2026
Merged

adinauer merged 4 commits into
9.x.xfrom
feat/4818-stack-overflow-truncation

Conversation

@adinauer

Copy link
Copy Markdown
Member

📜 Description

Changes stack trace truncation to retain the 50 oldest and 200 newest frames instead of only the 100 newest frames.

The limit applies consistently to exception and thread stack traces. Sentry-owned frames are filtered before applying the limit, and only retained frames are converted to protocol objects to bound allocation work.

💡 Motivation and Context

Keeping frames from both ends preserves the origin of deep or recursive call stacks while retaining the most recent frames around the failure. The 250-frame policy matches Relay's current stack trace normalization limits and avoids sending frames that Relay would discard.

💚 How did you test it?

  • make format api
  • ./gradlew :sentry:test --tests io.sentry.SentryStackTraceFactoryTest --tests io.sentry.SentryExceptionFactoryTest --tests io.sentry.SentryThreadFactoryTest

📝 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

None.

Retain the 50 oldest and 200 newest frames for exception and thread stack traces. Align the SDK frame budget with Relay while bounding frame conversion work.

Fixes #4818
@linear-code

linear-code Bot commented Nov 16, 2026

Copy link
Copy Markdown

JAVA-208

@sentry

sentry Bot commented Nov 16, 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

@adinauer
adinauer marked this pull request as ready for review November 17, 2026 13:24
@adinauer
adinauer requested a review from a team as a code owner November 17, 2026 13:24
@adinauer
adinauer requested review from markushi and romtsn and removed request for a team November 17, 2026 13:24
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 17, 2026
Comment thread CHANGELOG.md Resolved
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit 3188dde.

Main concerns: reach, data sent to Sentry, host performance.

This label is a hint for reviewers, not an approval.

@adinauer
adinauer merged commit 9582f69 into 9.x.x Nov 20, 2026
41 of 42 checks passed
@adinauer
adinauer deleted the feat/4818-stack-overflow-truncation branch November 20, 2026 09:43
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.

2 participants