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

`SentryCrashMonitor` crashes on macOS and iOS

Open sindresorhus opened this issue 3 years ago • 19 comments

Environment

How do you use Sentry?

Sentry SaaS (sentry.io)

Which SDK and version?

7.5.2

Steps to Reproduce

  1. Look at this report: https://sentry.io/organizations/sindresorhus/issues/2847452452/events/76b39b939f954ff1b446cf770b33d3ba/
  2. Notice how it crashed in "Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.cpp:169"

Expected Result

I expected the crash monitor to not crash.

Actual Result

The reason I think the crash monitor itself is crashing is that the crash reason is EXC_BAD_INSTRUCTION: callStackSymbols. I don't access callStackSymbols anywhere in my own code.

sindresorhus avatar Dec 09 '21 10:12 sindresorhus

SentryCrashMonitor_CPPException.cpp:169 is calling g_originalTerminateHandler(). As pointed out by you @sindresorhus, it could be that the crash monitor is crashing itself. Do you maybe have a way to reproduce this?

philipphofmann avatar Dec 09 '21 11:12 philipphofmann

Do you maybe have a way to reproduce this?

I don't. It didn't crash for me. Just a crash report from a random user.

sindresorhus avatar Dec 09 '21 18:12 sindresorhus

Thanks for the info, @sindresorhus. According to your report, it happened once. We will keep an eye on this, but without a repro, it will be hard to fix.

philipphofmann avatar Dec 13 '21 10:12 philipphofmann

Longshot, but maybe it needs a NULL check like here: https://github.com/kstenerud/KSCrash/pull/41/files

sindresorhus avatar Dec 26 '21 00:12 sindresorhus

The original KSCrashMonitor_CPPException has a few changes our SentryCrashMonitor_CPPException doesn't have. I think a good start would be to include the latest fixes of KSCrash also into our SentryCrash.

philipphofmann avatar Dec 28 '21 15:12 philipphofmann

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[bot] avatar Jan 19 '22 15:01 github-actions[bot]

Please keep this open.

sindresorhus avatar Jan 20 '22 02:01 sindresorhus

We see this fairly regularly on iOS. The first instance was 7.2.6, and the most recent was 7.9.0. We've had approximately 24k events over the past 7 months. Here's an example.

We haven't been able to find the root cause, as we've not triggered it locally.

squarefrog avatar Feb 02 '22 09:02 squarefrog

Thanks for the information, @squarefrog. So you didn't see the problem before using 7.2.6, or did you start using Sentry with 7.2.6?

philipphofmann avatar Mar 01 '22 09:03 philipphofmann

@philipphofmann that's a great question. We've used Sentry since 5.0.2, so I think it's reasonable to assume we didn't get it before 7.2.6

squarefrog avatar Mar 01 '22 13:03 squarefrog

Maybe it's related to https://github.com/getsentry/sentry-cocoa/blob/d2df66ae9612bf7621bc5da788d1cc107f0ba22f/Sources/SentryCrash/Recording/Monitors/SentryCrashMonitor_CPPException.cpp#L83 done in https://github.com/getsentry/sentry-cocoa/pull/1083 which was released with https://github.com/getsentry/sentry-cocoa/blob/master/CHANGELOG.md#720. Thanks for the input.

philipphofmann avatar Mar 01 '22 14:03 philipphofmann

Also seeing this crash, and after upgrading it seems to be happening even more. This is pretty bad, as it's practically our only crash happening in our app.

mpasalic avatar Mar 30 '22 23:03 mpasalic

I'm sorry about that. Thanks for the update, @mpasalic.

philipphofmann avatar Mar 31 '22 15:03 philipphofmann

I have the same problem here, but it happens on iPad Pro, currently using sdk version 6.2.1, I found that the error started from iPadOS 15.0, I wonder if some new features of iPadOS 15.0 sdk are not compatible. I hope it can be solved as soon as possible, thank you image

MountainTao avatar Jul 07 '22 03:07 MountainTao

The same issue as @MountainTao has. We are now using SDK version 7.15.0 iPhones: iOS 16.0.0 iPads: iPadOS 15.3.0, 15.5.0 OnPhone – SentryCrashMonitor_CPPException cpp line 171 – Firebase console 2022-07-19 15-05-49

But the crash reason in Firebase Console is different, here are two examples:

Fatal Exception: NSInvalidArgumentException *** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: title)

Fatal Exception: NSInvalidArgumentException -[SKStoreProductViewController sceneDisconnected:]: unrecognized selector sent to instance 0x1049c4600

StasMalinovsky avatar Jul 19 '22 11:07 StasMalinovsky

I'm still seeing this: https://sentry.io/organizations/sindresorhus/issues/3410158760/events/5107abe27a2048b5bbf0aef1aa889195/

Unhandled: callStackSymbols

sindresorhus avatar Jul 20 '22 13:07 sindresorhus

I found that the error started from iPadOS 15.0,

We have reports of this going back to iOS 14 (our minimum deployment version), so I'm not sure this is the cause.

Screenshot 2022-08-24 at 11 30 44

Has there been any movement on this issue? It's one of our highest impact crashes, and we're still seeing it in sdk v7.23.0.

OS Version: iOS 15.6.1 (19G82)
Report Version: 104

Exception Type: EXC_CRASH (SIGABRT)
Crashed Thread: 0

Application Specific Information:
NSException > terminating with %s exception of type %s > terminating with uncaught exception of type NSException > XTUM

Thread 0 Crashed:
0   libsystem_kernel.dylib          0x39f58fb38         __pthread_kill
1   libsystem_pthread.dylib         0x4130733b8         pthread_kill
2   libsystem_c.dylib               0x345fa2520         abort
3   libc++abi.dylib                 0x361a03b78         abort_message
4   libc++abi.dylib                 0x3619f39c0         demangling_terminate_handler
5   libobjc.A.dylib                 0x3617eec64         _objc_terminate
6   [REDACTED]                    0x2011d95f8         CPPExceptionTerminate (SentryCrashMonitor_CPPException.cpp:171)
7   libc++abi.dylib                 0x361a02f14         std::__terminate
8   libc++abi.dylib                 0x361a05eb8         __cxa_rethrow
9   libobjc.A.dylib                 0x3617ea6bc         objc_exception_rethrow
10  CoreFoundation                  0x32fc8acb0         CFRunLoopRunSpecific
11  GraphicsServices                0x367f7f370         GSEventRunModal
12  UIKitCore                       0x334a7cb54         -[UIApplication _run]
13  UIKitCore                       0x3347fe08c         UIApplicationMain
14  [REDACTED]                   0x20079e420         main ([REDACTED])
15  <unknown>                       0x101fcdda4         <redacted>

squarefrog avatar Aug 24 '22 10:08 squarefrog

Thanks for the info, @squarefrog. Now we know it's also happening on iOS.

philipphofmann avatar Aug 31 '22 07:08 philipphofmann

Hello, we have also encountered this bug, which is the most frequent bug in our app.

image

OS Version: iOS 15.6.1 (19G82) Report Version: 104

Exception Type: EXC_CRASH (SIGABRT) Crashed Thread: 9

Application Specific Information: NSException > terminating with %s exception of type %s > terminating with uncaught exception of type NSException

Thread 9 Crashed: 0 libsystem_kernel.dylib 0x372199b38 __pthread_kill 1 libsystem_pthread.dylib 0x3e4fd73bc pthread_kill 2 libsystem_c.dylib 0x318e5e524 abort 3 libc++abi.dylib 0x3348bfb7c 4 libc++abi.dylib 0x3348af9c4 5 libobjc.A.dylib 0x3346aac68 6 myapp 0x2068abec4 CPPExceptionTerminate (SentryCrashMonitor_CPPException.cpp:171) 7 libc++abi.dylib 0x3348bef18 8 libc++abi.dylib 0x3348beeb4 std::terminate 9 libdispatch.dylib 0x302525a44 10 libdispatch.dylib 0x302528c1c 11 libdispatch.dylib 0x302537164 12 libdispatch.dylib 0x30253796c 13 libsystem_pthread.dylib 0x3e4fd1080 _pthread_wqthread

yufanghui avatar Sep 22 '22 02:09 yufanghui

Hello! We're having the same issue using "@sentry/react-native": "^3.2.13" @philipphofmann image

ErrorPro avatar Oct 05 '22 14:10 ErrorPro

Thanks for the update, @ErrorPro.

philipphofmann avatar Oct 06 '22 13:10 philipphofmann