feat: ios native anr capture#2679
Open
bitsandfoxes wants to merge 13 commits into
Open
Conversation
Contributor
|
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.
Reviewed by Cursor Bugbot for commit a7c7670. Configure here.
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.

Resolves https://github.com/getsentry/team-gdx/issues/151
What does it do
This PR forwards the new flag
EnableAppHangTrackingtosentry-cocoa(maps toenableAppHangTracking). The timeout is reused. This replaces the C# watchdog on platforms that are supported bysentry-cocoa.Why does it do it
On iOS, the Unity player loop runs on the main thread (the one with the
CFRunLoop). The generatedUnityAppController.mmregisters Unity's frame tick as aCADisplayLinkcallback on the main run loop. EveryUpdate,FixedUpdate, andLateUpdateexecute on that single thread. Native UIKit/AppKit events share the same queue.So when a Unity script blocks (e.g. infinite loop in
Update, synchronous I/O, deadlock on.Wait()), it blocks the iOS main run loop directly.sentry-cocoa's watchdog enqueues a block on the main queue and times its execution. That means if Unity is stuck, that block never runs, and that hang is reported.This allows us to replace the Unity SDK C# ANR integration. The generated native ANR event from
sentry-cocoacontains an actual stack trace, making the report actually actionable.How does it do it
We're in the process of deprecating
AnrEnabledand putting the app freeze capture behaviour underEnableAppHangTracking. But unlike on Android, this replaces the C# watchdog entirely. We will need to follow up on this for Android as well, see #2681Result
The resulting native event contains a fully symbolicated stack trace of the C# code that caused the freeze.
Follow up
We'll need to work on the in-app frames to clean up the stack trace presentation.