firebase-ios-sdk: Crash in - -[FIRAMonitor saveMonitoringDataToUserDefaultsOnMonitorQueue]

Firebase SDK version - 4.5.0

App crashed at this function but couldn’t understand why? Please help!!!

#6. Crashed: FIRAMonitorQueue
0  libobjc.A.dylib                0x1801201a0 objc_retain + 16
1  UIKit                          0x18ac5cf74 __32+[_UIApplicationCanvas canvases]_block_invoke + 24
2  Foundation                     0x18151d4a4 -[NSBlockPredicate evaluateWithObject:substitutionVariables:] + 212
3  Foundation                     0x18151d358 _filterObjectsUsingPredicate + 360
4  Foundation                     0x18151d154 -[NSArray(NSPredicateSupport) filteredArrayUsingPredicate:] + 280
5  UIKit                          0x18ac5cf28 +[_UIApplicationCanvas canvases] + 172
6  UIKit                          0x18ac5cfc8 +[_UIApplicationCanvas mostActiveCanvas] + 28
7  UIKit                          0x18a0023c4 -[UIApplication isSuspended] + 32
8  UIKit                          0x18a107908 UpdateSystemSoundActiveStatus + 72
9  UIKit                          0x18a107ab8 IsSystemSoundEnabled + 104
10 UIKit                          0x18a1078e8 UpdateSystemSoundActiveStatus + 40
11 UIKit                          0x18a119300 -[UIDevice _updateSystemSoundActiveStatus:] + 144
12 CoreFoundation                 0x180b8212c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
13 CoreFoundation                 0x180b816cc _CFXRegistrationPost + 420
14 CoreFoundation                 0x180b81430 ___CFXNotificationPost_block_invoke + 60
15 CoreFoundation                 0x180bfe9f4 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1408
16 CoreFoundation                 0x180ab83e0 _CFXNotificationPost + 380
17 Foundation                     0x1814d8498 -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
18 HomagePro                      0x100b61ea4 -[FIRAMonitor saveMonitoringDataToUserDefaultsOnMonitorQueue] + 4307623588
19 libdispatch.dylib              0x180575088 _dispatch_call_block_and_release + 24
20 libdispatch.dylib              0x180575048 _dispatch_client_callout + 16
21 libdispatch.dylib              0x1805b31c0 _dispatch_queue_serial_drain$VARIANT$armv81 + 520
22 libdispatch.dylib              0x1805b3b30 _dispatch_queue_invoke$VARIANT$armv81 + 340
23 libdispatch.dylib              0x1805b4528 _dispatch_root_queue_drain_deferred_wlh$VARIANT$armv81 + 380
24 libdispatch.dylib              0x1805bc5c4 _dispatch_workloop_worker_thread$VARIANT$armv81 + 640
25 libsystem_pthread.dylib        0x18081afe0 _pthread_wqthread + 932
26 libsystem_pthread.dylib        0x18081ac30 start_wqthread + 4

--

#0. com.apple.main-thread
0  libsystem_kernel.dylib         0x1806e8bc4 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1806e8a3c mach_msg + 72
2  CoreFoundation                 0x180b97ce4 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x180b958b0 __CFRunLoopRun + 1424
4  CoreFoundation                 0x180ab62d8 CFRunLoopRunSpecific + 436
5  GraphicsServices               0x182947f84 GSEventRunModal + 100
6  UIKit                          0x18a062880 UIApplicationMain + 208
7  HomagePro                      0x1008f1588 main (IntroductionVC.swift:17)
8  libdyld.dylib                  0x1805da56c start + 4

#1. Thread
0  libsystem_kernel.dylib         0x180709dbc __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x18081afb0 _pthread_wqthread + 884
2  libsystem_pthread.dylib        0x18081ac30 start_wqthread + 4

#2. com.apple.uikit.eventfetch-thread
0  libsystem_kernel.dylib         0x1806e8bc4 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1806e8a3c mach_msg + 72
2  CoreFoundation                 0x180b97ce4 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x180b958b0 __CFRunLoopRun + 1424
4  CoreFoundation                 0x180ab62d8 CFRunLoopRunSpecific + 436
5  Foundation                     0x1814de6e4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6  Foundation                     0x1814fdafc -[NSRunLoop(NSRunLoop) runUntilDate:] + 96
7  UIKit                          0x18abae02c -[UIEventFetcher threadMain] + 136
8  Foundation                     0x1815df860 __NSThread__start__ + 996
9  libsystem_pthread.dylib        0x18081c32c _pthread_body + 308
10 libsystem_pthread.dylib        0x18081c1f8 _pthread_body + 310
11 libsystem_pthread.dylib        0x18081ac38 thread_start + 4

#3. Thread
0  libsystem_kernel.dylib         0x180709dbc __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x18081b144 _pthread_wqthread + 1288
2  libsystem_pthread.dylib        0x18081ac30 start_wqthread + 4

#4. com.apple.NSURLConnectionLoader
0  libsystem_kernel.dylib         0x1806e8bc4 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1806e8a3c mach_msg + 72
2  CoreFoundation                 0x180b97ce4 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x180b958b0 __CFRunLoopRun + 1424
4  CoreFoundation                 0x180ab62d8 CFRunLoopRunSpecific + 436
5  CFNetwork                      0x18121fb40 +[NSURLConnection(Loader) _resourceLoadLoop:] + 404
6  Foundation                     0x1815df860 __NSThread__start__ + 996
7  libsystem_pthread.dylib        0x18081c32c _pthread_body + 308
8  libsystem_pthread.dylib        0x18081c1f8 _pthread_body + 310
9  libsystem_pthread.dylib        0x18081ac38 thread_start + 4

#5. Thread
0  libsystem_kernel.dylib         0x180709dbc __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x18081afb0 _pthread_wqthread + 884
2  libsystem_pthread.dylib        0x18081ac30 start_wqthread + 4

#6. Crashed: FIRAMonitorQueue
0  libobjc.A.dylib                0x1801201a0 objc_retain + 16
1  UIKit                          0x18ac5cf74 __32+[_UIApplicationCanvas canvases]_block_invoke + 24
2  Foundation                     0x18151d4a4 -[NSBlockPredicate evaluateWithObject:substitutionVariables:] + 212
3  Foundation                     0x18151d358 _filterObjectsUsingPredicate + 360
4  Foundation                     0x18151d154 -[NSArray(NSPredicateSupport) filteredArrayUsingPredicate:] + 280
5  UIKit                          0x18ac5cf28 +[_UIApplicationCanvas canvases] + 172
6  UIKit                          0x18ac5cfc8 +[_UIApplicationCanvas mostActiveCanvas] + 28
7  UIKit                          0x18a0023c4 -[UIApplication isSuspended] + 32
8  UIKit                          0x18a107908 UpdateSystemSoundActiveStatus + 72
9  UIKit                          0x18a107ab8 IsSystemSoundEnabled + 104
10 UIKit                          0x18a1078e8 UpdateSystemSoundActiveStatus + 40
11 UIKit                          0x18a119300 -[UIDevice _updateSystemSoundActiveStatus:] + 144
12 CoreFoundation                 0x180b8212c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
13 CoreFoundation                 0x180b816cc _CFXRegistrationPost + 420
14 CoreFoundation                 0x180b81430 ___CFXNotificationPost_block_invoke + 60
15 CoreFoundation                 0x180bfe9f4 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1408
16 CoreFoundation                 0x180ab83e0 _CFXNotificationPost + 380
17 Foundation                     0x1814d8498 -[NSNotificationCenter postNotificationName:object:userInfo:] + 68
18 HomagePro                      0x100b61ea4 -[FIRAMonitor saveMonitoringDataToUserDefaultsOnMonitorQueue] + 4307623588
19 libdispatch.dylib              0x180575088 _dispatch_call_block_and_release + 24
20 libdispatch.dylib              0x180575048 _dispatch_client_callout + 16
21 libdispatch.dylib              0x1805b31c0 _dispatch_queue_serial_drain$VARIANT$armv81 + 520
22 libdispatch.dylib              0x1805b3b30 _dispatch_queue_invoke$VARIANT$armv81 + 340
23 libdispatch.dylib              0x1805b4528 _dispatch_root_queue_drain_deferred_wlh$VARIANT$armv81 + 380
24 libdispatch.dylib              0x1805bc5c4 _dispatch_workloop_worker_thread$VARIANT$armv81 + 640
25 libsystem_pthread.dylib        0x18081afe0 _pthread_wqthread + 932
26 libsystem_pthread.dylib        0x18081ac30 start_wqthread + 4

#7. com.twitter.crashlytics.ios.MachExceptionServer
0  HomagePro                      0x100afd8d4 CLSProcessRecordAllThreads (CLSProcess.c:376)
1  HomagePro                      0x100afd8d4 CLSProcessRecordAllThreads (CLSProcess.c:376)
2  HomagePro                      0x100afd784 CLSProcessRecordAllThreads (CLSProcess.c:407)
3  HomagePro                      0x100aeda44 CLSHandler (CLSHandler.m:26)
4  HomagePro                      0x100ae8a04 CLSMachExceptionServer (CLSMachException.c:446)
5  libsystem_pthread.dylib        0x18081c32c _pthread_body + 308
6  libsystem_pthread.dylib        0x18081c1f8 _pthread_body + 310
7  libsystem_pthread.dylib        0x18081ac38 thread_start + 4

#8. Thread
0  libsystem_kernel.dylib         0x180709dbc __workq_kernreturn + 8
1  libsystem_pthread.dylib        0x18081b144 _pthread_wqthread + 1288
2  libsystem_pthread.dylib        0x18081ac30 start_wqthread + 4

#9. com.squareup.SocketRocket.NetworkThread
0  libsystem_kernel.dylib         0x1806e8bc4 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1806e8a3c mach_msg + 72
2  CoreFoundation                 0x180b97ce4 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x180b958b0 __CFRunLoopRun + 1424
4  CoreFoundation                 0x180ab62d8 CFRunLoopRunSpecific + 436
5  Foundation                     0x1814de6e4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 304
6  HomagePro                      0x100c2a6f8 -[_FSRRunLoopThread main] + 4308444920
7  Foundation                     0x1815df860 __NSThread__start__ + 996
8  libsystem_pthread.dylib        0x18081c32c _pthread_body + 308
9  libsystem_pthread.dylib        0x18081c1f8 _pthread_body + 310
10 libsystem_pthread.dylib        0x18081ac38 thread_start + 4

#10. com.apple.CFSocket.private
0  libsystem_kernel.dylib         0x180709570 __select + 8
1  CoreFoundation                 0x180ba021c __CFSocketManager + 644
2  libsystem_pthread.dylib        0x18081c32c _pthread_body + 308
3  libsystem_pthread.dylib        0x18081c1f8 _pthread_body + 310
4  libsystem_pthread.dylib        0x18081ac38 thread_start + 4

#11. Thread
0  libsystem_kernel.dylib         0x180709150 __psynch_cvwait + 8
1  libsystem_pthread.dylib        0x180822fd0 _pthread_cond_wait$VARIANT$armv81 + 624
2  libc++.1.dylib                 0x180087ea4 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 24
3  JavaScriptCore                 0x187e34b30 void std::__1::condition_variable_any::wait<std::__1::unique_lock<bmalloc::Mutex> >(std::__1::unique_lock<bmalloc::Mutex>&) + 96
4  JavaScriptCore                 0x187e34a58 bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>::threadRunLoop() + 172
5  JavaScriptCore                 0x187e34dbc void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>*), bmalloc::AsyncTask<bmalloc::Heap, void (bmalloc::Heap::*)()>*> >(void*) + 44
6  libsystem_pthread.dylib        0x18081c32c _pthread_body + 308
7  libsystem_pthread.dylib        0x18081c1f8 _pthread_body + 310
8  libsystem_pthread.dylib        0x18081ac38 thread_start + 4

#12. WebThread
0  libsystem_kernel.dylib         0x1806e8bc4 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1806e8a3c mach_msg + 72
2  CoreFoundation                 0x180b97ce4 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x180b958b0 __CFRunLoopRun + 1424
4  CoreFoundation                 0x180ab62d8 CFRunLoopRunSpecific + 436
5  WebCore                        0x188905ac4 RunWebThread(void*) + 456
6  libsystem_pthread.dylib        0x18081c32c _pthread_body + 308
7  libsystem_pthread.dylib        0x18081c1f8 _pthread_body + 310
8  libsystem_pthread.dylib        0x18081ac38 thread_start + 4

#13. com.apple.CoreMotion.MotionThread
0  libsystem_kernel.dylib         0x1806e8bc4 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1806e8a3c mach_msg + 72
2  CoreFoundation                 0x180b97ce4 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x180b958b0 __CFRunLoopRun + 1424
4  CoreFoundation                 0x180ab62d8 CFRunLoopRunSpecific + 436
5  CoreFoundation                 0x180b0512c CFRunLoopRun + 116
6  CoreMotion                     0x185e9a088 (null) + 227076
7  libsystem_pthread.dylib        0x18081c32c _pthread_body + 308
8  libsystem_pthread.dylib        0x18081c1f8 _pthread_body + 310
9  libsystem_pthread.dylib        0x18081ac38 thread_start + 4

#14. AVAudioSession Notify Thread
0  libsystem_kernel.dylib         0x1806e8bc4 mach_msg_trap + 8
1  libsystem_kernel.dylib         0x1806e8a3c mach_msg + 72
2  CoreFoundation                 0x180b97ce4 __CFRunLoopServiceMachPort + 196
3  CoreFoundation                 0x180b958b0 __CFRunLoopRun + 1424
4  CoreFoundation                 0x180ab62d8 CFRunLoopRunSpecific + 436
5  AVFAudio                       0x18637f774 GenericRunLoopThread::Entry(void*) + 164
6  AVFAudio                       0x1863aa018 CAPThread::Entry(CAPThread*) + 84
7  libsystem_pthread.dylib        0x18081c32c _pthread_body + 308
8  libsystem_pthread.dylib        0x18081c1f8 _pthread_body + 310
9  libsystem_pthread.dylib        0x18081ac38 thread_start + 4

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 48 (10 by maintainers)

Most upvoted comments

Hey all,

We have a pending fix for this bug. It’ll be undergoing some review before it’s released, but we hope to have this resolved soon.

You’ll need to add the key-value pair in the plist yourself.

I’ve seen similar crashes, most in iOS 11. The top of the crash stack is:

Thread 25 Crashed:
0   libobjc.A.dylib                 objc_retain + 16
1   CoreFoundation                  +[__NSArrayI __new::::] + 184
2   CoreFoundation                  -[NSArray initWithArray:range:copyItems:] + 396
3   UIKit                           +[_UICanvas canvases] + 32
4   UIKit                           +[_UIApplicationCanvas canvases] + 56
5   UIKit                           +[_UIApplicationCanvas mostActiveCanvas] + 28
6   UIKit                           -[UIApplication isSuspendedEventsOnly] + 32
7   UIKit                           UpdateSystemSoundActiveStatus + 116
8   UIKit                           IsSystemSoundEnabled + 104
9   UIKit                           UpdateSystemSoundActiveStatus + 40
10  UIKit                           -[UIDevice _updateSystemSoundActiveStatus:] + 144
11  CoreFoundation                  __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
12  CoreFoundation                  _CFXRegistrationPost + 420
13  CoreFoundation                  ___CFXNotificationPost_block_invoke + 60
14  CoreFoundation                  -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 1408
15  CoreFoundation                  _CFXNotificationPost + 380
16  Foundation                      -[NSNotificationCenter postNotificationName:object:userInfo:] + 68

I have no idea why this happens, or how to reproduce the crash. But I think it is an Apple bug, because it access UI elements in background thread.

Let me know if you have any thoughts.

The latest version has the Info.plist flag. Please update to the latest version. The flag will be on by default in subsequent release.

Hey all, given the response to the flagged fix we’re going to enable the flag by default in the next update of Firebase.

I’ll close this issue for now, it’ll go out with the M30 milestone in the next Analytics release. If it regresses after that, please comment here and I’ll re-open the issue.

Thanks all!

Hi, thanks. We’ll try this in our next release and get back to you asap for feedback. @rdamiano we have encountered this issue for more than one year, but it’s quite minor as we have only a few user sessions crashing over thousand at each release.

Can you upgrade to the latest Analytics SDK, and add the flag UseCFPreferencesLibrary=YES in the Info.plist? Please let us know whether it fixes the crashes

Yes I’m not sure what this is about, I’m not doing anything “special” with Firebase Analytics with my iOS app and this is one of the biggest crashes, so I have to believe it’s happening to everyone…for months.

I contacted @katowulf for the potential fix to download, he told me something like “looks like the fix has already been verified”?

yo guys any update on this one?

Not yet. The fix brings a lot of complexity, so it’s likely to be in review for a while.

b/64945474 is the internal bug number.

iOS allows listening to NSUserDefaults changes by adding an observer to it: https://developer.apple.com/documentation/foundation/nsuserdefaultsdidchangenotification . When the SDK updates NSUserDefaults, the system notifies its observers automatically. That’s why you can see on the line: 17 Foundation 0x1814d8498 -[NSNotificationCenter postNotificationName:object:userInfo:] + 68 It was originated from “Foundation”. It seems to me that there is a private code from the system that listens to this change automatically: 8 UIKit 0x18a107908 UpdateSystemSoundActiveStatus + 72 9 UIKit 0x18a107ab8 IsSystemSoundEnabled + 104 10 UIKit 0x18a1078e8 UpdateSystemSoundActiveStatus + 40 11 UIKit 0x18a119300 -[UIDevice _updateSystemSoundActiveStatus:] + 144