getsentry/sentry-cocoa

Crash in SentryTracer hasUnfinishedChildSpansToWaitFor (SentryTracer.m:502)

Closed this issue · 2 comments

Platform

iOS

Environment

Production

Installed

Carthage

Version

8.27.0

Xcode Version

15.2

Did it work on previous versions?

No response

Steps to Reproduce

So far, this has happened only once, in production, never while debugging.

Expected Result

Expecting that it would not crash.

Would it be possible to just add a @try/catch block around this function, so that - in the rare scenario that it crashes, it would silently crash, rather than crashing whole application?

Actual Result

Crash.

1c860b0bf5824caeb44a0b24ad2446de-symbolicated.txt

Relevant parts:

Thread 15
0 libsystem_kernel.dylib 0x3b0ab761c __ulock_wait2
1 libsystem_platform.dylib 0x3d84974d8
2 libobjc.A.dylib 0x30e668e78 objc_sync_enter
3 Sentry 0x102ba397c -[SentryTracer finishInternal] (SentryTracer.m:585)
4 Sentry 0x102ba2784 -[SentryTracer spanFinished:] (SentryTracer.m:409)
5 Sentry 0x102ba7c6c -[SentrySpan finishWithStatus:] (SentrySpan.m:242)
6 Sentry 0x102bf3354 -[SentryCoreDataTracker managedObjectContext:executeFetchRequest:error:originalImp:] (SentryCoreDataTracker.m:62)
7 Sentry 0x102be2544 __42-[SentryCoreDataSwizzling swizzleCoreData]_block_invoke_2 (SentryCoreDataSwizzling.m:39)

Thread 0 Crashed:
0 Sentry 0x102ba31c4 -[SentryTracer hasUnfinishedChildSpansToWaitFor] (SentryTracer.m:502)
1 Sentry 0x102ba2df8 -[SentryTracer canBeFinished] (SentryTracer.m:470)
2 Sentry 0x102be0604 -[SentryPerformanceTracker finishSpan:withStatus:] (SentryPerformanceTracker.m:208)
3 Sentry 0x102bddd4c __102-[SentryUIViewControllerPerformanceTracker finishTransaction:status:lifecycleMethod:callbackToOrigin:]_block_invoke (SentryUIViewControllerPerformanceTracker.m:260)
4 Sentry 0x102bde4e8 -[SentryUIViewControllerPerformanceTracker limitOverride:target:callbackToOrigin:block:] (SentryUIViewControllerPerformanceTracker.m:378)
5 Sentry 0x102bddb8c -[SentryUIViewControllerPerformanceTracker finishTransaction:status:lifecycleMethod:callbackToOrigin:] (SentryUIViewControllerPerformanceTracker.m:266)
6 Sentry 0x102bdda80 -[SentryUIViewControllerPerformanceTracker viewControllerViewDidAppear:callbackToOrigin:] (SentryUIViewControllerPerformanceTracker.m:198)
7 Sentry 0x102bd6bcc __56-[SentryUIViewControllerSwizzling swizzleViewDidAppear:]_block_invoke_2 (SentryUIViewControllerSwizzling.m:395)

Are you willing to submit a PR?

No response

Thanks @GuntisTreulands for reaching out.

Would it be possible to just add a @try/catch block around this function

Unfortunately no, objc try/catch dont work this way, and this particular crash would not be captured.

Are you sure this error happen in the version 8.27.0? Because the line 502 of SentryTracer.m doesn't have code in it.

We need to investigate, I can't reproduce this.

@brustolin It appears indeed that the product was built with version 8.21.0.
That explains it then. Sorry for the false alarm.