feat(native): Added App Hang capture for macOS#1780
Open
bitsandfoxes wants to merge 29 commits into
Open
Conversation
native_backend_flush_scope runs on every scope mutation (set_tag, set_context, set_user, ...). Folding breadcrumbs into the flushed base event re-serialized the entire breadcrumb ring on each of those calls - prohibitive on a hot path such as a 60fps game main thread. Give apply_scope a scope-mode argument: the continuous flush now passes SENTRY_SCOPE_NONE, while the crash handler still passes SENTRY_SCOPE_BREADCRUMBS to capture them at crash time (the process's last chance to record them). This matches the pre-existing behavior before breadcrumbs were added to the shared flush path. Co-Authored-By: Claude <noreply@anthropic.com>
|
macOS
82a09d4 to
f5c4eaa
Compare
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 b1674db. 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/155
The Goal
The goal is to have a mechanism that allows capture of frozen/stuck main threads. The resulting event should provide the same level of detail and insights as actual errors. This means contexts, tags, breadcrumbs, trace, and stack trace.
The How
With the new native crash backend we have a daemon running out-of-process. We want to re-use this to monitor a heartbeat. Whatever is considered the main thread periodically calls
heartbeaton the SDK. This reset the timestamp. The daemon captures the state of the stuck process should the timestamp exceed the configured threshold.For this the PR adds the following new API:
sentry_options_set_app_hang_enabled:sentry_options_set_app_hang_timeout_mssentry_app_hang_heartbeatWe can consider extending this in the future by
The Result
Sample event, see here.