GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(android): Backfill pre-init ANR and native crash metadata by romtsn · Pull Request #5762 · getsentry/sentry-java

Conversation

@romtsn

@romtsn romtsn commented Jul 14, 2026 •
edited by markushi
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

📜 Description

Backfill release, environment, distribution (dist), and app version/build on ANR and native crash events from the current SDK options when persisted values are unavailable.

This covers exits that happen before SDK initialization, when the SDK has not yet persisted those options. Current values are used only when the app has not been updated since the exit. A missing or invalid package update timestamp is treated conservatively so historical events are not attributed to a newer app version.

💡 Motivation and Context

ANR and native crash events are reported from ApplicationExitInfo on the next SDK initialization. If the terminated process exited before initializing the SDK, release-related options were never persisted and the reported event can be missing useful metadata.

The reporting process already has the same values in its current options when the package has not been updated. Comparing the exit timestamp with PackageInfo.lastUpdateTime allows those values to be used without attaching metadata from a newer app version.

Closes #4227
Closes #3287

💚 How did you test it?

  • ./gradlew ':sentry-android-core:testDebugUnitTest' --tests='*ApplicationExitInfoEventProcessorTest*' --info (42 tests passed)
  • ./gradlew spotlessApply apiDump

📝 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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sentry

sentry Bot commented Jul 14, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-android Build Distribution Settings

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Jul 14, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 366.72 ms 421.20 ms 54.48 ms
Size 0 B 0 B 0 B

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
b193867 331.08 ms 397.06 ms 65.98 ms
3d205d0 352.15 ms 432.53 ms 80.38 ms
22ff2c7 306.60 ms 336.65 ms 30.05 ms
a5ab36f 320.47 ms 389.77 ms 69.30 ms
539ca63 313.51 ms 355.43 ms 41.92 ms
dba088c 365.46 ms 366.31 ms 0.85 ms
4e3e79d 312.02 ms 376.24 ms 64.22 ms
7314dbe 437.83 ms 505.64 ms 67.81 ms
ad8da22 314.38 ms 352.29 ms 37.91 ms
bb0ff41 344.70 ms 413.82 ms 69.12 ms

App size

Revision Plain With Sentry Diff
b193867 1.58 MiB 2.19 MiB 620.00 KiB
3d205d0 1.58 MiB 2.10 MiB 532.97 KiB
22ff2c7 0 B 0 B 0 B
a5ab36f 1.58 MiB 2.12 MiB 555.26 KiB
539ca63 1.58 MiB 2.12 MiB 551.41 KiB
dba088c 1.58 MiB 2.13 MiB 558.99 KiB
4e3e79d 0 B 0 B 0 B
7314dbe 1.58 MiB 2.10 MiB 533.45 KiB
ad8da22 1.58 MiB 2.29 MiB 719.83 KiB
bb0ff41 0 B 0 B 0 B

Previous results on branch: romtsn/fix/validate-app-update-timestamp

Startup times

Revision Plain With Sentry Diff
7a20e16 323.59 ms 368.29 ms 44.70 ms
44877bd 415.47 ms 481.56 ms 66.09 ms
d4ce194 321.51 ms 369.29 ms 47.78 ms
22c1033 369.33 ms 441.47 ms 72.14 ms
a9a5631 319.09 ms 346.39 ms 27.30 ms
ead255a 325.67 ms 389.78 ms 64.11 ms
d19c570 292.57 ms 374.07 ms 81.50 ms
2c23a73 316.81 ms 364.28 ms 47.47 ms
17b29d9 311.50 ms 357.90 ms 46.40 ms
25fde38 314.47 ms 363.17 ms 48.70 ms

App size

Revision Plain With Sentry Diff
7a20e16 0 B 0 B 0 B
44877bd 0 B 0 B 0 B
d4ce194 0 B 0 B 0 B
22c1033 0 B 0 B 0 B
a9a5631 0 B 0 B 0 B
ead255a 0 B 0 B 0 B
d19c570 0 B 0 B 0 B
2c23a73 0 B 0 B 0 B
17b29d9 0 B 0 B 0 B
25fde38 0 B 0 B 0 B
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@romtsn romtsn changed the title fix(android): Backfill exit options when app is unchanged fix(android): Backfill pre-init ANR and native crash metadata Jul 15, 2026
@romtsn
romtsn marked this pull request as ready for review July 15, 2026 07:58
@romtsn
romtsn requested review from 0xadam-brown, adinauer, markushi and runningcode as code owners July 15, 2026 07:58
cursor[bot]
cursor Bot reviewed Jul 15, 2026
View reviewed changes
Comment thread sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

sentry[bot]
sentry Bot reviewed Jul 15, 2026
View reviewed changes
Comment thread sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

markushi
markushi reviewed Jul 16, 2026
View reviewed changes

@markushi markushi left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly minor nits, apart from the return handling of isAppNotUpdated()

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Jul 16, 2026
View reviewed changes
Comment thread sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

markushi
markushi approved these changes Jul 16, 2026
View reviewed changes
cursor[bot]
cursor Bot reviewed Jul 16, 2026
View reviewed changes
Comment thread sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Jul 16, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a7436f4. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

sentry[bot]
sentry Bot reviewed Jul 17, 2026
View reviewed changes
Comment thread sentry-android-core/src/main/java/io/sentry/android/core/ApplicationExitInfoEventProcessor.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

romtsn and others added 14 commits July 17, 2026 12:26
@romtsn
fix(android): Backfill exit options when app is unchanged
e21f046
Use current options when persisted values are missing and the app has not been updated since the exit. Avoid attributing historical crashes to a newer app version.
@romtsn
changelog
3f338ac
@romtsn @codex
fix(android): Backfill app context for historical exits
c51d508
Populate app version and build for historical ANR and native crash events when the current package metadata is safe to use.

Co-Authored-By: Codex <[email protected]>
@romtsn @codex
fix(android): Limit historical app metadata backfill
6279c13
Backfill only app version and build for historical exits. Avoid attaching current localized app names, identifiers, or split APK state to older events.

Co-Authored-By: Codex <[email protected]>
@romtsn @codex
fix(android): Reject unknown exit timestamps
ad691ca
Do not use current SDK options when an exit timestamp is unavailable because an intervening app update cannot be ruled out.

Co-Authored-By: Codex <[email protected]>
@romtsn @codex
fix(android): Validate persisted options cache generation
aaab013
Persist the app update timestamp after writing the options snapshot. Trust cached release, environment, and dist only when the marker identifies the current app installation, preserving launch-specific values without leaking stale metadata across app updates.

Co-Authored-By: Codex <[email protected]>
@romtsn @codex
fix(android): Validate launch-specific cached options
83014c9
Apply the app-generation marker when selecting option tags and the replay-on-error sample rate. Preserve values from the crashed launch within one app version while rejecting stale values after an update.

Co-Authored-By: Codex <[email protected]>
@romtsn @codex
docs(android): Explain options cache marker ordering
df59d98
Document why the generation observer uses its release callback only after the options cache has been fully persisted.

Co-Authored-By: Codex <[email protected]>
@romtsn @codex
fix(android): Validate exit option cache sources
50dd281
Reject option caches created after an exit and keep immutable build metadata aligned with the event's app generation. This prevents intermediate releases and stale ProGuard or SDK metadata from being attached to historical exits.

Co-Authored-By: Codex <[email protected]>
@romtsn @codex
style(android): Annotate nullable app context
a0a9ed0
Co-Authored-By: OpenAI Codex <[email protected]>
@romtsn @codex
docs(android): Explain options cache generation observer
07c919f
Clarify why the observer is ordered after option persistence and update the changelog to describe the generation-aware behavior.

Co-Authored-By: OpenAI Codex <[email protected]>
@romtsn @codex
docs(android): Add cache generation example
35d7272
Document the same-build, account-specific options scenario that requires preferring a matching persisted snapshot.

Co-Authored-By: OpenAI Codex <[email protected]>
@romtsn @codex
ref(android): Reuse cache utilities for generation marker
0030e2f
Expose cache serialization helpers as internal API and use them for the Android options cache generation marker.

Co-Authored-By: OpenAI Codex <[email protected]>
@romtsn @codex
docs(android): Explain exit option selection
cb2d080
Document how launch options, build metadata, and cache generations are selected for application exit events.

Co-Authored-By: OpenAI Codex <[email protected]>
@romtsn
romtsn force-pushed the romtsn/fix/validate-app-update-timestamp branch from 7bad815 to cb2d080 Compare July 17, 2026 10:27
@romtsn @codex
docs: Move changelog entry to Unreleased
184111e
Keep PR #5762 out of the already released 8.49.0 section.

Co-Authored-By: Codex <[email protected]>
@romtsn
romtsn enabled auto-merge (squash) July 17, 2026 10:32
sentry[bot]
sentry Bot reviewed Jul 17, 2026
View reviewed changes
Comment thread ...roid-core/src/main/java/io/sentry/android/core/PersistingOptionsCacheGenerationObserver.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@romtsn
romtsn merged commit 031ec33 into main Jul 17, 2026
71 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@romtsn
romtsn deleted the romtsn/fix/validate-app-update-timestamp branch July 17, 2026 10:43
This was referenced Jul 22, 2026
publish: getsentry/[email protected] getsentry/publish#8956
Closed
publish: getsentry/[email protected] getsentry/publish#8957
Closed
publish: getsentry/[email protected] getsentry/publish#8958
Closed
This was referenced Jul 22, 2026
Enrich ANRs happened before Sentry.init #3287
Closed
Auto release detection not working #4227
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@markushi markushi markushi approved these changes
@sentry sentry[bot] sentry[bot] left review comments
@cursor cursor[bot] cursor[bot] left review comments
@adinauer adinauer Awaiting requested review from adinauer adinauer is a code owner
@runningcode runningcode Awaiting requested review from runningcode
@0xadam-brown 0xadam-brown Awaiting requested review from 0xadam-brown

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Auto release detection not working Enrich ANRs happened before Sentry.init

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@romtsn @markushi
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.