firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

Crash in Firebase/Performance SDK: FPRNSURLSessionInstrument.m line 307 __InstrumentDataTaskWithRequestCompletionHandler_block_invoke_2

Open mehulios opened this issue 3 years ago • 7 comments

Model:iPhone 12 Orientation: Portrait RAM free: 102.02 MB Disk free: 60.35 GB Operating System Version:15.6.0 Orientation: Portrait Jailbroken:No Crash Date:Jul 29, 2022, 7:28:43 PM

Firebase V9.3.0

FPRNSURLSessionInstrument.m line 307 __InstrumentDataTaskWithRequestCompletionHandler_block_invoke_2

Fatal Exception: NSInvalidArgumentException *** -[_NSPlaceholderData initWithBase64EncodedString:options:]: nil string argument

Fatal Exception: NSInvalidArgumentException 0 CoreFoundation 0x99288 __exceptionPreprocess 1 libobjc.A.dylib 0x16744 objc_exception_throw 2 Foundation 0x9b8b4 -[NSISO8601DateFormatter dealloc] 3 CommonLibrary 0x24654 _hidden#245 + 283 (_hidden#299:283) 4 CommonLibrary 0x2b20c _hidden#579 + 195 (_hidden#657:195) 5 CommonLibrary 0x2eb2c _hidden#698 + 36 (_hidden#706:36) 6 UltraSDK 0x3cd2c _hidden#2341 + 326 (_hidden#2398:326) 7 UltraSDK 0x3efc0 _hidden#2399 + 582 (_hidden#2398:582) 8 UltraSDK 0x1b190 _hidden#1027 + 252 (_hidden#996:252) 9 UltraSDK 0x24248 _hidden#1323 + 66 (_hidden#1322:66) 10 FirebasePerformance 0x1c7f4 __InstrumentDataTaskWithRequestCompletionHandler_block_invoke_2 + 307 (FPRNSURLSessionInstrument.m:307) - crashing here 11 FirebasePerformance 0x1c7f4 __InstrumentDataTaskWithRequestCompletionHandler_block_invoke_2 + 307 (FPRNSURLSessionInstrument.m:307) 12 CFNetwork 0x22b6c CFURLRequestSetMainDocumentURL 13 CFNetwork 0x33d80 _CFNetworkErrorCopyLocalizedDescriptionWithHostname 14 libdispatch.dylib 0x1e6c _dispatch_call_block_and_release 15 libdispatch.dylib 0x3a30 _dispatch_client_callout 16 libdispatch.dylib 0xb124 _dispatch_lane_serial_drain 17 libdispatch.dylib 0xbcb4 _dispatch_lane_invoke 18 libdispatch.dylib 0x16500 _dispatch_workloop_worker_thread 19 libsystem_pthread.dylib 0x10bc _pthread_wqthread 20 libsystem_pthread.dylib 0xe5c start_wqthread

mehulios avatar Aug 01 '22 07:08 mehulios

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Aug 01 '22 07:08 google-oss-bot

Hi @mehulios, could you provide the detailed steps you made to reproduce the issue?

rizafran avatar Aug 01 '22 14:08 rizafran

Based on the backtrace, there may be an interoperability issue between Firebase Performance and Ultra SDK

paulb777 avatar Aug 01 '22 16:08 paulb777

Hi @mehulios, could you provide the detailed steps you made to reproduce the issue?

This is the only details we have from firebase Crashlytics. This has happened to some random user.

mehulios avatar Aug 01 '22 17:08 mehulios

Based on the backtrace, there may be an interoperability issue between Firebase Performance and Ultra SDK

@paulb777 Can you please elaborate more on this.

mehulios avatar Aug 01 '22 17:08 mehulios

Firebase Performance and Ultra SDK may may do swizzling in an incompatible way. Given that the crash is actually closer to the Ultra SDK, it might be better to start the investigation there.

paulb777 avatar Aug 01 '22 18:08 paulb777

@paulb777
The user has never utilised any Ultra SDK-related journeys prior to this crash. Please locate the precise logs that list Firebase performance as the cause of the crash.

Screenshot 2022-08-02 at 8 36 17 PM

mehulios avatar Aug 02 '22 15:08 mehulios

Can you symbolicate the hidden/missing symbols in the stack trace?

morganchen12 avatar Aug 11 '22 20:08 morganchen12

Hey @mehulios. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot avatar Aug 18 '22 01:08 google-oss-bot

hey google-oss-bot , we are also facing the same crash will upload the symbolicated crash logs

theScud avatar Aug 18 '22 06:08 theScud

@theScud Thanks. @google-oss-bot We have only this much details as of now, if we get any more details we will let you know.

mehulios avatar Aug 18 '22 06:08 mehulios

Fatal Exception: NSInvalidArgumentException
Invalid type in JSON write (NSURLError)

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x99288 __exceptionPreprocess
1  libobjc.A.dylib                0x16744 objc_exception_throw
2  Foundation                     0x46458 _writeJSONValue
3  Foundation                     0xb0cbc ___writeJSONObject_block_invoke
4  CoreFoundation                 0x401b8 __NSDICTIONARY_IS_CALLING_OUT_TO_A_BLOCK__
5  CoreFoundation                 0xd6874 -[__NSSingleEntryDictionaryI enumerateKeysAndObjectsWithOptions:usingBlock:]
6  Foundation                     0x31dc8 _writeJSONObject
7  Foundation                     0xb0cbc ___writeJSONObject_block_invoke
8  CoreFoundation                 0x401b8 __NSDICTIONARY_IS_CALLING_OUT_TO_A_BLOCK__
9  CoreFoundation                 0x581cc -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]
10 Foundation                     0x31dc8 _writeJSONObject
11 Foundation                     0xd7d9c ___writeJSONArray_block_invoke
12 CoreFoundation                 0xd564 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__
13 CoreFoundation                 0x4be10 -[__NSArrayM enumerateObjectsWithOptions:usingBlock:]
14 Foundation                     0x58200 _writeJSONArray
15 Foundation                     0xb0cbc ___writeJSONObject_block_invoke
16 CoreFoundation                 0x401b8 __NSDICTIONARY_IS_CALLING_OUT_TO_A_BLOCK__
17 CoreFoundation                 0x581cc -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]
18 Foundation                     0x31dc8 _writeJSONObject
19 Foundation                     0xa8c7c -[_NSJSONWriter dataWithRootObject:options:]
20 Foundation                     0x75a04 +[NSJSONSerialization dataWithJSONObject:options:error:]
21 HyperSDK                       0x25068 (Missing UUID b608b4f7f35234858a2dae9627db36fd)
22 HyperSDK                       0x23e94 (Missing UUID b608b4f7f35234858a2dae9627db36fd)
23 HyperSDK                       0x23c48 (Missing UUID b608b4f7f35234858a2dae9627db36fd)
24 HyperSDK                       0xe93c (Missing UUID b608b4f7f35234858a2dae9627db36fd)
25 FirebasePerformance            0x1bc64 __InstrumentDataTaskWithRequestCompletionHandler_block_invoke_2 + 300 (FPRNSURLSessionInstrument.m:300)
26 FirebasePerformance            0x1bc64 __InstrumentDataTaskWithRequestCompletionHandler_block_invoke_2 + 300 (FPRNSURLSessionInstrument.m:300)
27 CFNetwork                      0x22b6c CFURLRequestSetMainDocumentURL
28 CFNetwork                      0x33d80 _CFNetworkErrorCopyLocalizedDescriptionWithHostname
29 libdispatch.dylib              0x1e6c _dispatch_call_block_and_release
30 libdispatch.dylib              0x3a30 _dispatch_client_callout
31 libdispatch.dylib              0xb124 _dispatch_lane_serial_drain
32 libdispatch.dylib              0xbcb4 _dispatch_lane_invoke
33 libdispatch.dylib              0x16500 _dispatch_workloop_worker_thread
34 libsystem_pthread.dylib        0x10bc _pthread_wqthread
35 libsystem_pthread.dylib        0xe5c start_wqthread

Crashed: com.google.firebase.crashlytics.ios.exception
SIGABRT ABORT 0x00000001c5f53b38

Crashed: com.google.firebase.crashlytics.ios.exception
0  FirebaseCrashlytics            0x1cf2c FIRCLSProcessRecordAllThreads + 397 (FIRCLSProcess.c:397)
1  FirebaseCrashlytics            0x1d30c FIRCLSProcessRecordAllThreads + 428 (FIRCLSProcess.c:428)
2  FirebaseCrashlytics            0x1617c FIRCLSHandler + 34 (FIRCLSHandler.m:34)
3  FirebaseCrashlytics            0x10b48 __FIRCLSExceptionRecord_block_invoke + 218 (FIRCLSException.mm:218)
4  libdispatch.dylib              0x3a30 _dispatch_client_callout + 20
5  libdispatch.dylib              0x12c90 _dispatch_lane_barrier_sync_invoke_and_complete + 56
6  FirebaseCrashlytics            0x10304 FIRCLSExceptionRecord + 225 (FIRCLSException.mm:225)
7  FirebaseCrashlytics            0x105f0 FIRCLSExceptionRecordNSException + 111 (FIRCLSException.mm:111)
8  FirebaseCrashlytics            0xfee8 FIRCLSTerminateHandler() + 279 (FIRCLSException.mm:279)
9  libc++abi.dylib                0x10f18 std::__terminate(void (*)()) + 20
10 libc++abi.dylib                0x10eb4 std::terminate() + 64
11 libobjc.A.dylib                0x2d248 objc::DenseMapBase<objc::DenseMap<objc_class*, PendingInitialize*, objc::DenseMapValueInfo<PendingInitialize*>, objc::DenseMapInfo<objc_class*>, objc::detail::DenseMapPair<objc_class*, PendingInitialize*> >, objc_class*, PendingInitialize*, objc::DenseMapValueInfo<PendingInitialize*>, objc::DenseMapInfo<objc_class*>, objc::detail::DenseMapPair<objc_class*, PendingInitialize*> >::FatalCorruptHashTables(objc::detail::DenseMapPair<objc_class*, PendingInitialize*> const*, unsigned int) const + 14
12 libdispatch.dylib              0x3a44 _dispatch_client_callout + 40
13 libdispatch.dylib              0xb124 _dispatch_lane_serial_drain + 668
14 libdispatch.dylib              0xbcb4 _dispatch_lane_invoke + 444
15 libdispatch.dylib              0x16500 _dispatch_workloop_worker_thread + 648
16 libsystem_pthread.dylib        0x10bc _pthread_wqthread + 288
17 libsystem_pthread.dylib        0xe5c start_wqthread + 8

does this help ? unfortunately i am not able to get logs from Xcode organiser,

we don't use Ultra SDK, Also a weird thing is there was a spike of crashes on August 14 - 15th after which the numbers dropped down.

i can give you a list of 3rd party libraries (well to a certain extent) if required. Or let me know if there is anything specific like swizzling you want me to look for

theScud avatar Aug 18 '22 06:08 theScud

Thanks, this is very helpful. This line

Invalid type in JSON write (NSURLError)

suggests that the value passed into +[NSJSONSerialization dataWithJSONObject:options:error:] by HyperSDK contains a type that cannot be serialized, ~~which Performance does in order to record network request performance~~.

We can likely fix this on the SDK side by checking if the object is valid JSON before trying to serialize it.

morganchen12 avatar Aug 18 '22 20:08 morganchen12

It turns out my last comment was wrong and Performance does not call any JSON serializer methods. You should contact the HyperSDK vendor and tell them to fix this issue on their end.

Also, this crash is different from the original crash, which is crashing in -[NSISO8601DateFormatter dealloc] as a result of this exception:

Fatal Exception: NSInvalidArgumentException
*** -[_NSPlaceholderData initWithBase64EncodedString:options:]: nil string argument

morganchen12 avatar Aug 18 '22 20:08 morganchen12

Oh okay, Thanks for the info @morganchen12 . i'll reach out to them, apologies if this side tracked the original issue.

theScud avatar Aug 19 '22 05:08 theScud

Hey @mehulios. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot avatar Aug 26 '22 01:08 google-oss-bot

Since there haven't been any recent updates here, I am going to close this issue.

@mehulios if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

google-oss-bot avatar Sep 02 '22 01:09 google-oss-bot