OutOfMemory error logged when the app is manually killed after the SDK is closed.
Environment
Which SDK and version? react-native-sentry 2.5.1 with sentry-cocoa 7.0.0 (but I checked and master probably has the same issue).
Steps to Reproduce
[SentrySDK close]followed byexit(0);.- App resumes, initializes the SentrySDK and logs OutOfMemory sentry event.
Expected Result
App should resume and not log an event because the SDK was closed during the crash. I can prevent this by disabling OOM tracking, but I would prefer to keep it on and have the SDK not record crashes that occurred after the SDK was closed. We re-initialize the SDK when the app launches again, and it compares to the state prior to the close, and determines it was a crash.
Actual Result
Sentry logged an OutOfMemory event.
The OS most likely terminated your app because it overused RAM.
Proposed Solution
The SentryAppState should be reset to willTerminate = YES when the SDK is closed.
It looks like the problem is that currently the SentryOutOfMemoryTracker's stop method is invoked properly but it doesn't update the app state when stopping, and it should probably do it synchronously.
For posterity my local fix for this is to invoke [self willTerminate] from [SentryOutOfMemoryTracker stop] and to modify the updateAppState method to be synchronous. It works but probably isn't fleshed out enough to be a PR.
Thanks for reporting this, @mmerickel. This should be an easy fix in the SentryOutOfMemoryTracker. We just need to consider SentrySDK.close properly.
we just upgraded from 6.x to 7 and are seeing this as well.
PR #1272 should have addressed it. It was shipped on version 7.2.3
Please free free to reopen this if the issue persists
I won't be able to confirm this soon but it looks like the fix that I was expecting and operating similarly to how we patched it internally - in a much hackier way. :-) Thank you all for working on this!
Sadly, I'm still getting this error. We are using Sentry via its React Native integration, which is on 7.3.0. It does not seem to be a legitimate OOM, and we are only getting it in our staging version where we recently upgraded sentry to the latest version (2.4.2 => 3.1.1).
The Podfile.lock shows that Sentry/Core (= 7.3.0) is installed. It previously showed: Sentry/Core (= 6.1.4).
@savv, have you managed to get around this issue?
I'm still seeing it on version "@sentry/react-native": "^3.1.1" with - Sentry (= 7.3.0)
Yes, I am still seeing this issue
On Mon, 25 Oct 2021 at 07:41, Matt Di Florio @.***> wrote:
@savv https://github.com/savv, have you managed to get around this issue?
I'm still seeing it on version @.***/react-native": "^3.1.1" with `- Sentry (= 7.3.0)"
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/getsentry/sentry-cocoa/issues/1185#issuecomment-950522233, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFWP73FHJZ3NDSF7X3LK4LUITNXTANCNFSM466M3MUA .
@mierz00 fyi - see here https://github.com/getsentry/sentry-react-native/issues/1830
Still seeing this issue on the flutter sdk also.
Still seeing this issue on the flutter sdk also.
I am in the same situation.
Thanks, for reporting this. I'm going to reopen this again. Most likely this is due to exit(0), which our current OOM logic can't detect reliably. We need to investigate how we can fix these false OOMs. Sorry about the inconvenience.
@philipphofmann see https://github.com/getsentry/sentry-react-native/issues/1830#issuecomment-957871432 and https://github.com/getsentry/sentry-react-native/issues/1830#issuecomment-963348497
This does not exclusively happen with exit(0) (which is anyway not allowed on iOS).
Thanks, @savv for pointing that out.
https://github.com/getsentry/sentry-react-native/issues/1830#issuecomment-957871432:
All Codepush users are seeing this issue whenever the app updates, even though the app is not terminated. So this is not just a prerelease/niche issue.
I found two potential problems. First, maybe we don't pass the release name properly down from hybrid SDKs to Cocoa https://github.com/getsentry/sentry-cocoa/blob/4499a316e36d7dfb355678e97303bacb32e8949f/Sources/Sentry/SentryOutOfMemoryLogic.m#L50-L53
Second, maybe we don't receive the willTerminateNotification properly from hybrid SDKs https://github.com/getsentry/sentry-cocoa/blob/4499a316e36d7dfb355678e97303bacb32e8949f/Sources/Sentry/SentryOutOfMemoryTracker.m#L70-L73
Same problem here
When closing the SDK we only remove the observers
https://github.com/getsentry/sentry-cocoa/blob/67eabc633b23d9a6727399910aea972deb1c02e3/Sources/Sentry/SentryOutOfMemoryTracker.m#L105-L110
but the SDK should properly set the app state so on the next start it doesn't generate an OOM.
@philipphofmann I'm sorry if this is the wrong place to ask, but today I've received hundred of false OOM errors logged in Sentry. I haven't even executed the app that many times, so I'm thinking maybe they've been stemming from Xcode previews. I use native iOS with Sentry 7.11.0 with Xcode 13.3.
Do you get these errors in debug or in release? @denizdogan
@philipphofmann This is just during debugging/developing. It hasn't been released.