Skip to content

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

Open
adinauer wants to merge 3 commits into
9.x.xfrom
feat/4818-stack-overflow-truncation
Open

adinauer wants to merge 3 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

This branch has not been deployed

No deployments
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