Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK reports OOM when crashing after calling close #2457

Closed
philipphofmann opened this issue Nov 29, 2022 · 1 comment
Closed

SDK reports OOM when crashing after calling close #2457

philipphofmann opened this issue Nov 29, 2022 · 1 comment

Comments

@philipphofmann
Copy link
Member

Platform

iOS

Installed

Manually

Version

7.31.2

Steps to Reproduce

  1. Open iOS-Swift sample app
  2. Call SentrySDK.close
  3. Cause a crash by clicking the crash button

Expected Result

No OOM in Sentry.

The OutOfMemoryTracker correctly calls stop on the AppStateManager

[self.appStateManager stop];

but the AppStateManager.stop doesn't modify the app state

- (void)stop
{
if (self.startCount <= 0) {
return;
}
self.startCount -= 1;
if (self.startCount == 0) {
// Remove the observers with the most specific detail possible, see
// https://developer.apple.com/documentation/foundation/nsnotificationcenter/1413994-removeobserver
[NSNotificationCenter.defaultCenter
removeObserver:self
name:SentryNSNotificationCenterWrapper.didBecomeActiveNotificationName
object:nil];
[NSNotificationCenter.defaultCenter
removeObserver:self
name:SentryHybridSdkDidBecomeActiveNotificationName
object:nil];
[NSNotificationCenter.defaultCenter
removeObserver:self
name:SentryNSNotificationCenterWrapper.willResignActiveNotificationName
object:nil];
[NSNotificationCenter.defaultCenter
removeObserver:self
name:SentryNSNotificationCenterWrapper.willTerminateNotificationName
object:nil];
}
}

Then the OOMLogic things the app didn't terminate properly cause wasTerminated is not set

// The app was terminated normally
if (previousAppState.wasTerminated) {
return NO;
}

We could solve this by adding an extra property to the AppState called wasSDKRunning, and only report OOMs if this property is true.

Actual Result

The SDK reports an OOM to Sentry.

@kevinrenskers
Copy link
Contributor

I'm happy to pick this up, goes perfectly with #2460.

@kevinrenskers kevinrenskers moved this from Needs Discussion to Needs Review in Mobile & Cross Platform SDK Nov 30, 2022
Repository owner moved this from Needs Review to Done in Mobile & Cross Platform SDK Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants