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

Lots of OutOfMemory #1852

Closed
markuswahl-2 opened this issue May 25, 2022 · 37 comments
Closed

Lots of OutOfMemory #1852

markuswahl-2 opened this issue May 25, 2022 · 37 comments

Comments

@markuswahl-2
Copy link

Platform

iOS

Installed

CocoaPods

Version

7.11.0

Steps to Reproduce

We do not know. These are the only breadcrumbs from sentry.io:

CATEGORY DESCRIPTION LEVEL TIME
sentry.event A value set to the context or sdk is not serializable. Dropping context and sdk. Error 21:07:28
exception OutOfMemory: The OS most likely terminated your app because it overused RAM. Error 21:07:28

We are seeing this with sentry.cocoa 7.9.0, 7.10.2 and 7.11.0. One difference we see when we upgraded from 7.9.0 to 7.11.0 is that we no longer get the information about APP Start Time. With 7.9.0 we see that all such OOM events occur in the same second that the app was started. After having upgraded to 7.10.2 or 7.11.0 we no longer get that piece of information.

Expected Result

No crash

Actual Result

Tags

environment
production

event.environment
native

event.origin
ios

handled
no

level
fatal

mechanism
out_of_memory

@philipphofmann
Copy link
Member

philipphofmann commented May 27, 2022

I don't fully get your problem, @markuswahl-2. Can you please answer the following questions to clarify this issue:

  1. As you linked to the dart repo, I assume your app is built with Flutter and uses the Flutter SDK?
  2. Your expected result states no crash. Is the Cocoa SDK causing crashes in your app?
  3. Your title states lots of OutOfMemroy. So is the problem now, that your app crashes, or do you get a lot of OutOfMemory errors?
  4. What exactly do you mean by that we no longer get the information about APP Start Time?
  5. These are the only breadcrumbs from sentry.io: where did you get these breadcrumbs from? The OutOfMemory event?

In 7.11.0, we released a fix for detecting ANRs as false OOMs #1695. That's why you see a change in behavior.

@markuswahl-2
Copy link
Author

Hi!

  1. Yes
  2. Well, we do not know what causes it. We logged this bug report since we would be glad if we could get some more information out of sentry about these crashes. And since you have said that you have fixed the false OutOfMemory-reports in 7.11.0, we wanted to let you know that that is perhaps not the case. Ie that the problem is still there. I can see in iOS Native OOM  sentry-dart#814 that we are not the only ones that still see the OutOfMemory-reports even after updating to 7.11.0.
  3. We do not know. We have not observed the issue ourselves, only through the error reports from sentry.io. Do you know of a way for us to spot the difference? We get the tag fatal. Given that there was a problem (at least prior to 7.11.0) with false OutOfMemory-reports, can we infer from the tag fatal that these reports are for real, ie about real crashes and not just somehow false OutOfMemory-reports?
  4. The sentry.io section called APP (with sub headings App Build, ID, Build ID, Build Name and Start Time) are present for apps that use versions prior to 7.11.0 but that section is not present for apps that use version 7.11.0.
  5. Yes, on sentry.io. I gather that sentry.io renders this from the json-file attached to each report. I attach one file of each here (with-context-information-prior-to-7.11.0-redacted.json is the one where we can see the start time, without-context-information-using-7.11.0-redacted.json is the one were that information is missing). I am guessing that the context section in with-context-information-prior-to-7.11.0-redacted.json is the context that the error message "sentry.event - A value set to the context or sdk is not serializable. Dropping context and sdk." is all about...

We only see these OutOfMemory-reports from iOS devices.

Best regards,
Markus

@markuswahl-2
Copy link
Author

markuswahl-2 commented May 30, 2022

with-context-information-prior-to-7.11.0-redacted.json

{
  "event_id": "REDACTED",
  "project": REDACTED,
  "release": "REDACTED",
  "dist": "580",
  "platform": "cocoa",
  "message": "",
  "datetime": "2022-05-23T08:12:56.779649Z",
  "tags": [
    [
      "app.device",
      "REDACTED"
    ],
    [
      "device",
      "iPhone12,8"
    ],
    [
      "device.family",
      "iOS"
    ],
    [
      "environment",
      "production"
    ],
    [
      "event.environment",
      "native"
    ],
    [
      "event.origin",
      "ios"
    ],
    [
      "handled",
      "no"
    ],
    [
      "level",
      "fatal"
    ],
    [
      "mechanism",
      "out_of_memory"
    ],
    [
      "os",
      "iOS 15.4.1"
    ],
    [
      "os.name",
      "iOS"
    ],
    [
      "os.rooted",
      "no"
    ],
    [
      "dist",
      "580"
    ],
    [
      "release",
      "REDACTED"
    ],
    [
      "user",
      "id:REDACTED"
    ]
  ],
  "_metrics": {
    "bytes.ingested.event": 1410,
    "bytes.stored.event": 2623
  },
  "contexts": {
    "app": {
      "app_start_time": "2022-05-23T08:12:56Z",
      "device_app_hash": "REDACTED",
      "build_type": "app store",
      "app_identifier": "com.org.org",
      "app_name": "Organization Name App 2.0",
      "app_version": "1.0.10",
      "app_build": "580",
      "app_id": "REDACTED",
      "type": "app"
    },
    "device": {
      "family": "iOS",
      "model": "iPhone12,8",
      "model_id": "D79AP",
      "memory_size": 3100426240,
      "usable_memory": 1877671936,
      "storage_size": 63966400512,
      "boot_time": "2022-05-07T21:36:47Z",
      "timezone": "CEST",
      "locale": "en_SE",
      "type": "device"
    },
    "os": {
      "name": "iOS",
      "version": "15.4.1",
      "build": "19E258",
      "kernel_version": "Darwin Kernel Version 21.4.0: Mon Feb 21 21:27:53 PST 2022; root:xnu-8020.102.3~1/RELEASE_ARM64_T8030",
      "rooted": false,
      "type": "os"
    }
  },
  "culprit": "",
  "environment": "production",
  "exception": {
    "values": [
      {
        "type": "OutOfMemory",
        "value": "The OS most likely terminated your app because it overused RAM.",
        "mechanism": {
          "type": "out_of_memory",
          "handled": false
        }
      }
    ]
  },
  "fingerprint": [
    "{{ default }}"
  ],
  "grouping_config": {
    "enhancements": "eJybzDRxY3J-bm5-npWRgaGlroGxrpHxBABcYgcZ",
    "id": "newstyle:2019-05-08"
  },
  "hashes": [
    "REDACTED"
  ],
  "key_id": "REDACTED",
  "level": "fatal",
  "logger": "",
  "metadata": {
    "display_title_with_tree_label": true,
    "type": "OutOfMemory",
    "value": "The OS most likely terminated your app because it overused RAM."
  },
  "nodestore_insert": 1653293579.902627,
  "received": 1653293577.576998,
  "sdk": {
    "name": "sentry.cocoa",
    "version": "7.9.0",
    "integrations": [
      "isolateErrorIntegration",
      "runZonedGuardedIntegration",
      "widgetsFlutterBindingIntegration",
      "flutterErrorIntegration",
      "widgetsBindingIntegration"
    ]
  },
  "timestamp": 1653293576.779649,
  "title": "OutOfMemory: The OS most likely terminated your app because it overused RAM.",
  "type": "error",
  "user": {
    "id": "REDACTED",
    "ip_address": "REDACTED",
    "geo": {
      "country_code": "SE",
      "region": "Sweden"
    }
  },
  "version": "7",
  "location": null
}

@markuswahl-2
Copy link
Author

without-context-information-using-7.11.0-redacted.json

{
  "event_id": "REDACTED",
  "project": REDACTED,
  "release": "REDACTED",
  "dist": "805",
  "platform": "cocoa",
  "message": "",
  "datetime": "2022-05-30T08:51:06.743513Z",
  "tags": [
    [
      "environment",
      "production"
    ],
    [
      "event.environment",
      "native"
    ],
    [
      "event.origin",
      "ios"
    ],
    [
      "handled",
      "no"
    ],
    [
      "level",
      "fatal"
    ],
    [
      "mechanism",
      "out_of_memory"
    ],
    [
      "dist",
      "805"
    ],
    [
      "release",
      "REDACTED"
    ],
    [
      "user",
      "id:REDACTED"
    ]
  ],
  "_metrics": {
    "bytes.ingested.event": 701,
    "bytes.stored.event": 1796
  },
  "breadcrumbs": {
    "values": [
      {
        "timestamp": 1653900666.744,
        "type": "error",
        "category": "sentry.event",
        "level": "error",
        "message": "A value set to the context or sdk is not serializable. Dropping context and sdk."
      }
    ]
  },
  "culprit": "",
  "environment": "production",
  "exception": {
    "values": [
      {
        "type": "OutOfMemory",
        "value": "The OS most likely terminated your app because it overused RAM.",
        "mechanism": {
          "type": "out_of_memory",
          "handled": false
        }
      }
    ]
  },
  "fingerprint": [
    "{{ default }}"
  ],
  "grouping_config": {
    "enhancements": "REDACTED",
    "id": "newstyle:2019-05-08"
  },
  "hashes": [
    "REDACTED"
  ],
  "key_id": "REDACTED",
  "level": "fatal",
  "logger": "",
  "metadata": {
    "display_title_with_tree_label": true,
    "type": "OutOfMemory",
    "value": "The OS most likely terminated your app because it overused RAM."
  },
  "nodestore_insert": 1653900670.293765,
  "received": 1653900667.589878,
  "sdk": {
    "name": "sentry.cocoa",
    "version": "7.11.0"
  },
  "timestamp": 1653900666.743513,
  "title": "OutOfMemory: The OS most likely terminated your app because it overused RAM.",
  "type": "error",
  "user": {
    "id": "REDACTED",
    "ip_address": "REDACTED",
    "geo": {
      "country_code": "SE",
      "city": "Gothenburg",
      "region": "Sweden"
    }
  },
  "version": "7",
  "location": null
}

@philipphofmann
Copy link
Member

FYI, the Cocoa SDK creates the OOM errors on heuristics. There is no 100% guarantee that your app really crashed. Especially on hybrid platforms such as Flutter and RN, we had issues in the past that we created OOMs by mistake. You are not the first person to be confused by these OOM errors.

Can you provide a repro for an OOM event maybe?

I don't think that the Cocoa SDK causes the missing APP data. I think that one of the recent changes to the dart SDK causes this:

Is the APP data only missing for OOM errors or other events as well?

@markuswahl-2
Copy link
Author

markuswahl-2 commented Jun 2, 2022

I see. Thanks for your feedback.

We can see reports in sentry for other events where the APP data section is present.

In regards to the APP data section and the field "Start Time": After reading the heuristics section you mentioned, I understand that the OOM is reported the next time the app starts. If so, what does the "Start Time" field in the APP section indicate? Is it the start time of the app for the session that had an OOM or is it the start time of the app that reports the OOM (i e the next time the app starts)? If it is the latter, I understand that we can not infer how long the app had been live when (if) it experienced OOM, from the start time field in the APP section. Right?

With repro, you mean if we can reproduce it, right? I am afraid not.

@philipphofmann
Copy link
Member

This could be related to #1877

@philipphofmann
Copy link
Member

Hey @markuswahl-2, can you try to update to 7.18.0, because #1877 might have fixed the issue.

@markuswahl-2
Copy link
Author

Will do, thanks!

@markuswahl-2
Copy link
Author

I am afraid we still get those errors even after bumping to 7.18.1 of sentry.cocoa. Also we see a sudden other error (but in android of NoClassDefFoundError: io.sentry.flutter.f) after having bumped to 7.18.1.

@philipphofmann
Copy link
Member

I'm sorry to hear that, @markuswahl-2. Does your app do any background work? Could it be that it runs in the background and then goes into the foreground when the user actively opens it?

@markuswahl-2
Copy link
Author

I think that is possible. (That's normal for most apps, no?)

@philipphofmann
Copy link
Member

philipphofmann commented Jun 29, 2022

Yes, that's normal for sure, but I'm just asking because it could be that we don't detect this properly.

Do you maybe have enableAutoSessionTracking disabled, @markuswahl-2? If so, getsentry/sentry-dart#905 would fix the issue.

@markuswahl-2
Copy link
Author

OK, thanks.

It is this one, right?
https://pub.dev/documentation/sentry_flutter/latest/sentry_flutter/SentryFlutterOptions/enableAutoSessionTracking.html

It is no entirely clear to me from the docs what enableAutoSessionTracking does.

Do I understand it correctly that setting enableAutoSessionTracking to false (while keeping the default value of enableOutOfMemoryTracking of true), and waiting for getsentry/sentry-dart#905 to become available, I might expect improvements?

It goes without saying that we are very much still interested in getting reports about true OOM, it is just the possibly false OOM reports that we want to skip. 😃

@markuswahl-2
Copy link
Author

(And to answer your question, no we did not have enableAutoSessionTracking disabled, but we are considering to do it, especially once getsentry/sentry-dart#905 becomes available).

@philipphofmann
Copy link
Member

philipphofmann commented Jun 29, 2022

Do I understand it correctly that setting enableAutoSessionTracking to false (while keeping the default value of enableOutOfMemoryTracking of true), and waiting for getsentry/sentry-dart#905 to become available, I might expect improvements?

No, if you set enableAutoSessionTracking to false, it might get worse. That's why I asked. The default is true. If you didn't touch the option getsentry/sentry-dart#905 should not have an impact on you.

(And to answer your question, no we did not have enableAutoSessionTracking disabled, but we are considering to do it, especially once getsentry/sentry-dart#905 becomes available).

Why do you plan on disabling enableAutoSessionTracking? If you had it disabled in the past it could lead to wrongly reported OOMs. getsentry/sentry-dart#905 fixes this problem.

@philipphofmann
Copy link
Member

@markuswahl-2, I'm out of ideas. If you want, can you maybe send me the link to your project to philipp.hofmann@sentry.io so that I can look at your data? Maybe I spot something.

@markuswahl-2
Copy link
Author

No, I meant that we were eager to try setting enableAutoSessionTracking to false because I, incorrectly, understood from you that that might correct it. The setting enableAutoSessionTracking is and has always been unmodified in our source code. And now that I understand you, we will of course not disable that setting.

@markuswahl-2
Copy link
Author

Here are the five files in our app that touches upon Sentry. (I added suffix .txt because github did not allow them otherwise):
Podfile.lock.txt
leading_icon.dart.txt
main.dart.txt
pubspec.yaml.txt
pubspec.lock.txt

@philipphofmann
Copy link
Member

Thanks a lot for your update, @markuswahl-2. I didn't have time yet to look at your setup. I will get back to you later.

@github-actions
Copy link

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@markuswahl-2
Copy link
Author

Hi Philipp! I was away from keyboard during the summer. I am back now. Have you had some insight into this?

Best regards

@brustolin
Copy link
Contributor

Hello @markuswahl-2 Philipp is in PTO. Sorry but we need to wait for him to came back to look into this. We don't have enough bandwidth right now.

@markuswahl-2
Copy link
Author

Hello @philipphofmann
Have you had time to look at the files?
Best regards,
Markus

@philipphofmann
Copy link
Member

Hey, @markuswahl-2,

sorry, no didn't get to that yet. Try to do it this week.

@markuswahl-2
Copy link
Author

Hi @kevinrenskers
Have you have had a chance to look into this?

best regards,
Markus

@kevinrenskers
Copy link
Contributor

I am looking into this now.

@philipphofmann
Copy link
Member

Hey, @markuswahl-2,

Could it be that some parts of your app use exit(code)? We have an issue on React-Native for creating wrong OOMs when some code calls exit(code). getsentry/sentry-docs#4350.

We don't have any other ideas what could cause your OOMs at the moment. Do you by any chance have a way to reproduce it now?

@marandaneto
Copy link
Contributor

@philipphofmann I can also see that if I just stop the debugger and open it again, but this is likely an exit(0) example, will try a release mode.

@marandaneto
Copy link
Contributor

@markuswahl-2 I could not reproduce it using a release build, can you provide a minimal reproducible example and the steps to reproduce it?

@markuswahl-2
Copy link
Author

markuswahl-2 commented Oct 18, 2022

Hi! I am afraid we do not know how to reproduce it. We see it amongst our users, but we have not experienced it ourselves. No user has complained. This leads us to believe that we should ourselves have been exposed to the problem but that it has not manifested itself to us in a visible way. Or that it is a case of a false negative, i e that it is the heuristic-detection of OOM that falsely reports this as an OOM.

And no, we do not order the exit of the app.

We don't have a way to reproduce it. But our users reproduce it all the time. We do not see a pattern though...

@markuswahl-2
Copy link
Author

I understand that OOM is reported the next time the app starts. Is there a way for us to get some insights from sentry about the previous session, ie the session of the app that the OOM is reporting about? Maybe that way we could start to look for some patterns among the sessions that would have experienced the actual OOM.

@philipphofmann
Copy link
Member

Thanks for the update again, @markuswahl-2.

Is there a way for us to get some insights from sentry about the previous session, ie the session of the app that the OOM is reporting about?

No, not yet, but we have an issue for that #1759. It has a high priority, but I can't give you an ETA for it. This feature would definitely help to get a better understanding of what's going on for you.

We might also tackle MetricKit (#1661) in the following months, giving you OOMs with a stacktrace.

@github-actions
Copy link

github-actions bot commented Nov 9, 2022

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@kevinrenskers
Copy link
Contributor

@markuswahl-2 With #2347 merged, please try out the next release of the SDK to see if the added breadcrumbs for OOM events help to make sense of them.

@kevinrenskers kevinrenskers removed their assignment Nov 22, 2022
@kahest
Copy link
Member

kahest commented Nov 29, 2022

@markuswahl-2 did you get round to test this with a current release?

@github-actions
Copy link

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 5, 2023
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

6 participants