Repository navigation
Conversation
…ions in tests Finish the root span when the deadline timer fires too late so the transaction reads as finished (fixes the device-sleep drop test), enable options.isDebug in the two logger-mock tests so DiagnosticLogger forwards to the mock, and apply spotless formatting. Verified locally: spotlessCheck and the full SentryTracerTest suite pass on JDK 17.
|
Fixed the failing checks in 3bc4794: the root span is now finished when the deadline timer fires too late (so the dropped transaction reads as finished), the two logger-mock tests enable options.isDebug so DiagnosticLogger actually forwards to the mock, and the test file is spotless-formatted. Verified locally on JDK 17: spotlessCheck plus the full SentryTracerTest suite pass. |
Resolved conflicts, preserving this PR's change on top of upstream's restructuring. Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
|
Hi @mvanhorn sorry for the delay, we've just prioritized a project looking at how we measure time and set deadline timers in the SDK. It will be a big refactor and we will reconsider this PR if the refactor doesn't fix this issue. |
Resolve the SentryTracerTest import conflict by keeping both imports, move the changelog entry back under Unreleased, and compare the late deadline in long millis so the new -Werror LongDoubleConversion check passes.
|
Merged main back in (98e3ecd) to clear the SentryTracerTest import conflict. Two small follow-ups came with it: the changelog entry had drifted into an already released section, so it is back under Unreleased, and the late deadline check now compares in long millis because the new -Werror LongDoubleConversion rule flagged the old double math. spotlessCheck and SentryTracerTest (120 tests) pass locally on JDK 21. No rush on review given the timer refactor you mentioned. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 98e3ecd. Configure here.
The late-deadline drop path finished only the root span and returned, skipping child spans, the TransactionFinishedCallback, the performance collector stop, the transaction profiler and the TRACE profiler stop. Route it through forceFinish with a drop flag so all of that still runs and only captureTransaction is skipped.
|
Pushed 2755b91 to address the Bugbot finding on the late-deadline drop: it now reuses the normal finish path and skips only the capture, so profilers and the performance collector are no longer left running. All 121 SentryTracerTest cases are green on JDK 21, including the new one. Still no rush given the timer refactor. |

📜 Description
SentryTracernow records the wall-clock time when the deadline timeout is scheduled and, when the timer fires far later than scheduled (more than 2x the configureddeadlineTimeout), drops the transaction instead of force-finishing it withnow(). The drop follows the existingdropIfNoChildrenpattern infinish(): DEBUG log, clear the scope's transaction, cancel timers, nocaptureTransaction. Timers that fire within the slack behave exactly as before (forceFinish with DEADLINE_EXCEEDED).💡 Motivation and Context
When an Android app cold-starts and is backgrounded before first frame, the
ui.loadtransaction's 30s deadline timer (ajava.util.Timer) is frozen during Doze and fires only hours later when the device wakes.forceFinishthen stamps the root span and all children with the current time, producing app-start transactions spanning hours and skewing user-perceived launch metrics. "Timer fired far later than scheduled" is the exact failure signature, so the check stays in platform-neutral core with no Android API and no public API change.Resolves #5752
💚 How did you test it?
New unit tests in
SentryTracerTest: a deadline timeout that fires within the slack still force-finishes with DEADLINE_EXCEEDED; a simulated late fire (scheduled timestamp shifted beyond 2x deadline) drops the transaction, clears it from the scope, and captures nothing. Ran the sentry module test suite.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps