Repository navigation
fix(core): Mark transactions that outlive their deadline as deadline_exceeded (JAVA-642) - #6599
Merged
Merged
Conversation
…JAVA-642) The deadline timer counts on System.nanoTime(), which stops while an Android device is suspended. It ran hours late, and after a process freeze it raced the main thread, so ui.load transactions ended hours after the deadline, or measured TTID, TTFD and the app start to a late frame and finished as ok. SentryTracer now measures the deadline on the monotonic ticker, which counts suspend, and ends the transaction and its open spans at the wall time the deadline was reached. Once it has passed, every way of finishing the transaction takes that outcome. ActivityLifecycleIntegration applies it before handling a late first frame, full display or destroy, and PerformanceAndroidEventProcessor adds no app start measurement when the app start span was cut short. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
📲 Install BuildsAndroid
|
Starting a span after the deadline finished and captured the whole transaction on the thread that started the span, which may hold a lock. Return the no-op span only: the overdue deadline timer ends the transaction at the deadline right after. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…line Timings now stay exactly as before: the deadline timer ends spans at now() again, spans started after the deadline are recorded, and the ActivityLifecycleIntegration and PerformanceAndroidEventProcessor changes are reverted. Instead, once the monotonic-ticker deadline has passed, Span.finish gives the transaction and any span that finishes after it the status the deadline timer gives: the transaction's own status, or DEADLINE_EXCEEDED. Late frames after a device sleep then no longer report ok, so span.status:ok filters them out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runningcode
marked this pull request as ready for review
November 13, 2026 09:06
runningcode
requested review from
0xadam-brown and
romtsn
and removed request for
a team
November 13, 2026 09:06
markushi
approved these changes
Nov 17, 2026
markushi
left a comment
Member
There was a problem hiding this comment.
LGTM! Just one ergonomics concern, but that can be addressed later.
Resolve CHANGELOG.md conflict by keeping both Unreleased Fixes entries. Apply Spotless 8.11.0 formatting (from main) to ActivityLifecycleIntegrationTest.kt. Co-Authored-By: Markus Hintersteiner <markus.hintersteiner@sentry.io>
getDeadlineStatus() was only correct after a hasDeadlinePassed() check. Fold the check in, so getDeadlineExceededStatus() returns null until the deadline passes, and keep the timer callback as it is on main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
runningcode
enabled auto-merge (squash)
November 17, 2026 13:57
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
📜 Description
(Description is hand-written ;) )
Issue: The deadline timer stops counting during sleep/doze. So when the device resumes from sleep, the TTID (
onFirstFrameDrawn) and TTFD (onFullFrameDrawn) can fire before the deadline timer leading to hour or hours long TTID/TTFD. Normally these long transactions/spans are supposed to be marked withDEADLINE_EXCEEDEDbut they are not because the timer fires afterwards.Fix: Add a separate
DeadlinetoSentryTracerwith a ticker that counts deep sleep. When the transaction or span finishes it checks this deadline and marks it asDEADLINE_EXCEEDEDso they can be properly filtered out on dashboards. (Note this isn't the default filter, needs to be added)We intentionally don't change the length of any transactions in this PR to avoid breaking timings.
Side effect:
AppStartExtension.getExtendedEndTime()ignores an extended app start span with statusDEADLINE_EXCEEDED, so the extended app start vital is suppressed when that span finishes after the deadline.Note: my clanker found these two other issues that I'm intentionally leaving out of this PR:
enableStandaloneAppStartTracing) has no deadline, so we can have the hours long issue there too.SentryTracercan capture a transaction twice when two threads finish it at the same moment, for example the deadline timer andonActivityDestroyed. That race is already onmain.💡 Motivation and Context
💚 How did you test it?
Unit tests. Not tested on a device.
📝 Checklist
sendDefaultPIIis enabled.🤖 Generated with Claude Code