Skip to content

Add the option to ignore non fully blocking app hangsΒ #3492

@philipphofmann

Description

@philipphofmann

Description

Our app hang logic detects app hangs that don't fully block the main thread, which leads to inaccurate stack traces for such app hang events because the app hang logic might fire a bit too late to capture the proper stack trace responsible for the app hang. For some customers non-fully-blocking app hangs are noise, and they often disable the whole feature. Instead, we could provide an option only to report fully blocking app hangs. The option could be an enum something like reportAppHangLevel with (we have to come up with better names)

  1. FullyBlocking
  2. NonBlocking
  3. None

Implementation

To achieve this, we have to change our implementation a bit and might have to combine it with the CADisplayLink, which we already use for the SentryFramesTracker, but we have to be careful cause this can increase the CPU overhead, as pointed out here

* @discussion We decided against using a @c CFRunLoopObserver or the @c CADisplayLink, which the
* @c SentryFramesTracker already uses, because they come with two disadvantages. First, the
* solution is expensive. Quick benchmarks showed that hooking into the main thread's run loop and
* checking for every event to process if the main thread executes it in time added around 0,5 % of
* CPU overhead. Furthermore, if the main thread runs all scheduled events in time, it doesn't mean
* that there is no ANR ongoing. It could be that the run loop of the main thread is busy for 20
* seconds, and it executes all events in time. Instead, what matters is how long the main thread
* needs to execute a newly added event to the run loop.

Related GH discussion: #2715
Related GH issue for linking app hangs to profiles #3493.

### Tasks
- [ ] https://github.com/getsentry/sentry-cocoa/pull/4262
- [ ] https://github.com/getsentry/sentry-cocoa/pull/4265
- [ ] https://github.com/getsentry/sentry-cocoa/pull/4282
- [ ] https://github.com/getsentry/sentry-cocoa/pull/4285
- [ ] https://github.com/getsentry/sentry-cocoa/pull/4286
- [ ] https://github.com/getsentry/sentry-cocoa/pull/4356
- [ ] https://github.com/getsentry/sentry-cocoa/pull/4360
- [ ] https://github.com/getsentry/sentry-cocoa/pull/4379
- [ ] https://github.com/getsentry/sentry-docs/pull/11458

Metadata

Metadata

Labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions