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

Attach memory info to watchdog terminations

Open philipphofmann opened this issue 1 year ago • 1 comments

Description

The Sentry SDK could sample the memory information once every x seconds and store it with the app state on a bg thread and report that information when a watchdog termination occurs. Then, users would know if the watchdog termination was due to an OOM. This only works for OOMs that slowly add up and not for high spikes in memory pressure.

Related to https://github.com/getsentry/sentry-cocoa/issues/2514, https://github.com/getsentry/sentry-cocoa/issues/3890 and https://github.com/getsentry/sentry-cocoa/issues/3518.

philipphofmann avatar May 22 '24 13:05 philipphofmann

It probably makes sense to tackle this as part of a larger initiative to improve OOM/Watchdog terminations - see linked issues above.

kahest avatar May 29 '24 12:05 kahest

Yes, for now, there is no "app_memory" info when app crashes, but for other events, there is "app_memory" info. This is odd. I just take a look at previous codes, "app_memory" info was first added for crash (#4fb00e9), but later added for other events but removed for crash in later versions. So why? Can this info be added back?

ljql2001 avatar May 28 '25 08:05 ljql2001

@ljql2001 watchdog termination events currently do not have any app context in their payload. This is a bug and I am working on this in #5242, so maybe this will fix your issue aswell.

philprime avatar May 28 '25 11:05 philprime

@philprime I can see #5242 has already been merged to sentry-cocoa sdk in release 8.52.0. But our app has upgraded to 8.55.1, I make a crush manually, but I still cannot see "app_memory" field in the sentry crush event. Can you help check? Thanks.

ljql2001 avatar Sep 24 '25 09:09 ljql2001