feat: ios native app hang capture#2679
Open
bitsandfoxes wants to merge 15 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 cf3baf5. Configure here.
mujacica
approved these changes
May 22, 2026
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 a new flag
EnableAppHangTracking(defaulttrue) and a companionAppHangTimeout(default5s) to sentry-cocoa (mapped toenableAppHangTrackingandappHangTimeoutInterval). When enabled on iOS, this automatically replaces the Unity SDK's C# ANR integration at runtime. The Editor's Advanced tab gains separateC# WatchdogandAppHangTrackingsections so the two mechanisms are configurable side by side.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 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. If Unity is stuck, that block never runs, and the hang is reported. The generated native event contains an actual stack trace, making the report actionable.Note: This is not true on macOS.
sentry-cocoadoes not provide app hang detection there. SoEnableAppHangTrackingis wired through on iOS only for now. On every other platform the option is currently ano-op.Result
The resulting native event contains a fully symbolicated stack trace of the C# code that caused the freeze.
Follow up
sentry-nativeon macOS as experimental backend #2687Windows#2692