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

CrashedLastRun is false if app gets out of memory termination

Open andrey-vishnitskiy-hypemasters opened this issue 1 year ago • 10 comments
trafficstars

Environment

How do you use Sentry? Sentry SaaS (sentry.io)

Which version of the SDK? 1.7.1

How did you install the package? (Git-URL, Assetstore) git url

Which version of Unity? 2021.3.37

Is this happening in Unity (editor) or on a player like Android, iOS, Windows? iOS, Android

Steps to Reproduce

  1. Open app
  2. Allocate 2gb memory by creating textures
  3. Game crashes
  4. Reopen game
  5. Cache SentryUnityOptions at SentryRuntimeConfiguration.cs
  6. Call options.CrashedLastRun?.Invoke() after 10 sec

Expected Result

Have options.CrashedLastRun true because last session has a crash due out of memory

Actual Result

Have options.CrashedLastRun false

Any logs or screenshots

logs filtered by crash word.log

I get where you are coming from but the mechanism surrounding an Out Of Memor Crash is different and based on a heuristic and not a crash captured by the native SDKs. But I think that's a fair point, if the native SDKs assume that the app crashed due to an OOM event it should consider the the previous run as crashed. I'll bring this up with the team.

bitsandfoxes avatar May 08 '24 11:05 bitsandfoxes

Hi @bitsandfoxes, do you have any ETA for this topic?

Sorry @andrey-vishnitskiy-hypemasters, unfortunately, we don't have an ETA yet.

bitsandfoxes avatar Jun 17 '24 17:06 bitsandfoxes

Confirming, that as long as the native SDKs are reporting these terminations, the isCrashedLastRun should return true.

bitsandfoxes avatar Dec 12 '24 11:12 bitsandfoxes

Confirming, that as long as the native SDKs are reporting these terminations, the isCrashedLastRun should return true.

@philipphofmann does the cocoa SDK report true on OOM?

bruno-garcia avatar Mar 04 '25 16:03 bruno-garcia

No, it doesn't. It only returns true for crashedLastRun if SentryCrash detected a crash. I'm open to changing that if you think it makes sense.

https://github.com/getsentry/sentry-cocoa/blob/5c3fa88fefada71a9fd8c567cffd03f875dd94c7/Sources/Sentry/SentrySDK.m#L449-L452

philipphofmann avatar Mar 05 '25 15:03 philipphofmann

I'm open to changing that if you think it makes sense.

Conceptionally, the game did not close down "on its own volution" which - in my opinion - constitutes as a "crash" from the users perspective. Especially, since the SDK now surfaces that CrashedLastRun, there will be issues with false positives.

bitsandfoxes avatar Mar 07 '25 10:03 bitsandfoxes

I'm unsure if you think we should change crashedLastRun to include watchdog terminations and maybe also fatal app hangs or not?

philipphofmann avatar Mar 07 '25 10:03 philipphofmann

Yes. I think crashedLastRun should cover OOM, watchdog terminations (are those the same thing) and also fatal app hangs if possible.

bitsandfoxes avatar Mar 07 '25 10:03 bitsandfoxes

I created the issue: https://github.com/getsentry/sentry-cocoa/issues/4959.

philipphofmann avatar Mar 07 '25 12:03 philipphofmann