sentry-cocoa icon indicating copy to clipboard operation
sentry-cocoa copied to clipboard

Add App Hangs V2 for macOS

Open philipphofmann opened this issue 9 months ago • 7 comments

Description

AppHangsV2 only works on iOS, tvOS, and Catalyst cause it requires frame statistics, which we calculate using the CADisplayLink, which is only available on macOS 14 and above. We can consider porting app hangs v2 and calculating the frame statistics on macOS 14 and above.

We received a report that app hangs on macOS is producing plenty of false positives, which look like non fully blocking app hangs: https://github.com/getsentry/sentry-cocoa/issues/4947, which could be ignored with app hangs V2.

Please upvote if you want this feature.

philipphofmann avatar Mar 06 '25 14:03 philipphofmann

We could look into the CVDisplayLink which seems to be the set of methods which got deprecated by the CADisplayLink.

https://developer.apple.com/documentation/corevideo/cvdisplaylink-k0k

philprime avatar Mar 07 '25 08:03 philprime

@philprime do you mean we should look into CVDisplayLink for making it work on older macOS versions? If yes, I think we should skip it for the first iteration to keep the scope small.

philipphofmann avatar Mar 07 '25 10:03 philipphofmann

Yes, or maybe go directly for CVDisplayLink instead.

I see parallels on how UIImageGraphicsRenderer replaced UIGraphicsBeginImageContext(_:) which is backed by CoreGraphics

philprime avatar Mar 07 '25 10:03 philprime

It’s great to see that you already have plans to support this feature on macOS — we truly need it.

Currently, more than 10% of our users report app hanging issues on a daily basis. Unfortunately, the stack traces mostly point to system libraries, offering little insight for further investigation. At the same time, it’s nearly impossible for us to gauge the real impact of these hangs on user experience.

We really appreciate your work on this and are looking forward to the update!

LingnanZeng avatar Jun 09 '25 02:06 LingnanZeng

Spoke with @noahsmartin at WWDC about this and told him that I've been disabling this feature on macOS as I got a lot of false-positives. I've been running instruments to find hangs, but couldn't find any, while Sentry reported hangs in all kinds of places.

The truth must be somewhere in the middle, but I truly believe this feature can use some attention for macOS.

AvdLee avatar Jun 16 '25 09:06 AvdLee

Thank you @LingnanZeng and @AvdLee for the feedback!

philprime avatar Jun 16 '25 10:06 philprime