getsentry / sentry-cocoa

The official Sentry SDK for iOS, tvOS, macOS, watchOS.
https://sentry.io/for/cocoa/
MIT License
803 stars 317 forks source link

SentryCoreDataSwizzling crashing App sometimes #3454

Closed tensei closed 10 months ago

tensei commented 10 months ago

Platform

iOS

Environment

Production

Installed

Swift Package Manager

Version

8.16.1

Steps to Reproduce

Calling .save() on NSManagedObjectContext crashes the App sometimes

Expected Result

No crash

Actual Result

Event ID: c263d6dbc17549178a9e7e09a1f0103d crash

Are you willing to submit a PR?

No response

brustolin commented 10 months ago

Thanks for reporting this @tensei, we will look into this.

philipphofmann commented 10 months ago

We also see this in our internal SDK crashes.

realkosty commented 10 months ago

@tensei to mitigate you can temporarily disable the feature

options.enableCoreDataTracing = false
philipphofmann commented 10 months ago

I looked at a couple of crashes, and I think the underlying problem is that Sentry wrongly marks SentryCoreDataSwizzling as inApp. So it seems like the SentryCoreDataSwizzling is causing the crash, but instead, the inApp frames above are the root cause. We can fix this by updating our grouping config on the server. I will open a PR soon.

philipphofmann commented 10 months ago

This will be fixed on the server with https://github.com/getsentry/sentry/issues/60515, for which I already opened a PR https://github.com/getsentry/sentry/pull/61903. No SDK changes are required.

philipphofmann commented 10 months ago

Backend PR merged https://github.com/getsentry/sentry/pull/61903, so we'll release this soon after CI completes.