Skip to content

Tombstone events discarded from beforeSend are re-reported on every app launch #5973

Description

@gabriele-mazzotta-amo

Integration

sentry-android-ndk

Build System

Gradle

AGP Version

9.3.0

Proguard

Enabled

Other Error Monitoring Solution

No

Version

8.40.0

Steps to Reproduce

  1. Force a native crash, so that the OS records a Tombstone
  2. Restart the app: BeforeSendCallback is called for that crash (possibly a TombstoneMerged), discard it
  3. Restart the app again: BeforeSendCallback is called with a new event (Tombstone), carrying a different event timestamp, discard it
  4. Restart the app again: BeforeSendCallback is called with a new event (Tombstone), with the same event timestamp, discard it
  5. Every subsequent restart does the same, until the event is not discarded

Expected Result

Tombstone events discarded from SentryOptions.BeforeSendCallback are reported again at every app launch, until one of them is not discarded. This makes it hard to drop them based on some heuristic. A discarded crash should stay discarded.

As far as I can tell, this happens because the LAST_TOMBSTONE_REPORT marker is not written if the event is discarded.

We currently work around that by retrieving the crash timestamp from the hint, through the internal HintUtils.getSentrySdkHint() and NativeCrashExit, and use that in our heuristic. The timestamp of the event passed to BeforeSendCallback proved to be insufficient as the same crash can be first passed as TombstoneMerged and as a seemingly different Tombstone with a different event timestamp at a subsequent app start.

This behavior is a bit surprising, especially because it differs from how signalhandler events are handled. If this was intended and this is not a bug, please provide an easy way to discard events reliably without having to rely on internal APIs.

I believe the same holds true for ANRs, but I haven't really looked at those.

Actual Result

N/A

Activity

  1. linear-code commented on Aug 15, 2026

    @linear-code
  2. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Aug 15, 2026
  3. 0xadam-brown commented on Aug 21, 2026

    @0xadam-brown
    Member

    Thanks for raising this. We were able to repro, and the issue is worth a bit of thought so we can fix systematically. We'll take a look 🙌

  4. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Aug 21, 2026
  5. self-assigned this
    on Aug 26, 2026
  6. github-actions commented on Sep 3, 2026

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #6002, which was included in the 8.55.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions