Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛] NSGenericException - *** Collection <__NSDictionaryM: <address>> was mutated while being enumerated. #8260

Open
1 of 5 tasks
sandesh-wadal opened this issue Feb 3, 2025 · 3 comments

Comments

@sandesh-wadal
Copy link

sandesh-wadal commented Feb 3, 2025

Issue

Describe your issue here

We are using react-native firebase version 20.5.0.
Getting this crash on firebase console for iOS:

  • NSGenericException - *** Collection <__NSDictionaryM: <address>> was mutated while being enumerated.

Stacktrace file

Fatal Exception: NSGenericException
0  CoreFoundation                 0x2d5ec __exceptionPreprocess
1  libobjc.A.dylib                0x31244 objc_exception_throw
2  CoreFoundation                 0x17a28c -[__NSSingleObjectEnumerator init]
3  CoreFoundation                 0x29b14 -[NSDictionary containsObject:]
4  libloader                      0x6ee4d4 (Missing UUID d0f48e669ff2341e9ad39a5779f6a7ff)
5  libloader                      0x77a970 (Missing UUID d0f48e669ff2341e9ad39a5779f6a7ff)
6  libloader                      0x6ee270 (Missing UUID d0f48e669ff2341e9ad39a5779f6a7ff)
7  libloader                      0xe6f730 (Missing UUID d0f48e669ff2341e9ad39a5779f6a7ff)
8  libloader                      0x20b988 (Missing UUID d0f48e669ff2341e9ad39a5779f6a7ff)
9  libloader                      0xe9afbc (Missing UUID d0f48e669ff2341e9ad39a5779f6a7ff)
10 libsystem_pthread.dylib        0x17d0 _pthread_start
11 libsystem_pthread.dylib        0x1480 thread_start

com.apple.main-thread
0  libobjc.A.dylib                0x25368 cache_t::shouldFlush(objc_selector*, void (*)()) const + 44
1  libobjc.A.dylib                0x25310 invocation function for block in flushCaches(objc_class*, char const*, bool (objc_class*) block_pointer) + 40
2  libobjc.A.dylib                0x25068 flushCaches(objc_class*, char const*, bool (objc_class*) block_pointer) + 224
3  libobjc.A.dylib                0x26f98 _method_setImplementation(objc_class*, method_t*, void (*)()) + 328
4  libobjc.A.dylib                0x269e0 method_setImplementation + 136
5  kmbmobile                      0x1d515c -[FIRMessagingRemoteNotificationsProxy unswizzleSelector:inClass:] + 338 (FIRMessagingRemoteNotificationsProxy.m:338)
6  kmbmobile                      0x1d4894 -[FIRMessagingRemoteNotificationsProxy unswizzleUserNotificationCenterDelegate:] + 186 (FIRMessagingRemoteNotificationsProxy.m:186)
7  kmbmobile                      0x1d4c5c -[FIRMessagingRemoteNotificationsProxy observeValueForKeyPath:ofObject:change:context:] + 241 (FIRMessagingRemoteNotificationsProxy.m:241)
8  Foundation                     0x48e44 NSKeyValueNotifyObserver + 252
9  Foundation                     0x48b38 NSKeyValueDidChange + 384
10 Foundation                     0x478e8 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:] + 740
11 Foundation                     0x141390 -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:] + 64
12 Foundation                     0x140998 _NSSetObjectValueAndNotify + 404
13 kmbmobile                      0x3f68d8 __48-[RNFBMessagingUNUserNotificationCenter observe]_block_invoke + 60 (RNFBMessaging+UNUserNotificationCenter.m:60)
14 libdispatch.dylib              0x3fa8 _dispatch_client_callout + 20
15 libdispatch.dylib              0x57f4 _dispatch_once_callout + 32
16 kmbmobile                      0x3f6790 -[RNFBMessagingUNUserNotificationCenter observe] + 85 (once.h:85)
17 kmbmobile                      0x3f5990 -[RNFBMessagingNSNotificationCenter application_onDidFinishLaunchingNotification:] + 76 (RNFBMessaging+NSNotificationCenter.m:76)
18 CoreFoundation                 0x4e478 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
19 CoreFoundation                 0x4e394 ___CFXRegistrationPost_block_invoke + 88
20 CoreFoundation                 0x4cf08 _CFXRegistrationPost + 436
21 CoreFoundation                 0x4c00c _CFXNotificationPost + 728
22 Foundation                     0x9f50c -[NSNotificationCenter postNotificationName:object:userInfo:] + 92
23 UIKitCore                      0x478e48 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 3244
24 UIKitCore                      0x29a64c -[UIApplication _runWithMainScene:transitionContext:completion:] + 960
25 UIKitCore                      0x44c1a8 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 132
26 UIKitCore                      0x24f680 _UIScenePerformActionsWithLifecycleActionMask + 112
27 UIKitCore                      0x3ef114 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 220
28 UIKitCore                      0x3eee24 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 216
29 UIKitCore                      0x1b5874 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 608
30 UIKitCore                      0x1b5594 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 248
31 UIKitCore                      0x1b504c __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 148
32 UIKitCore                      0x1b41f4 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:] + 736
33 UIKitCore                      0x1b382c _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion + 224
34 UIKitCore                      0x1b34dc -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 316
35 UIKitCore                      0x24f430 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.229 + 612
36 UIKitCore                      0x24ed80 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 208
37 UIKitCore                      0x2467a4 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 244
38 UIKitCore                      0x22ea94 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 456
39 UIKitCore                      0x22cfa0 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 288
40 FrontBoardServices             0xc00c __95-[FBSScene _callOutQueue_didCreateWithTransitionContext:alternativeCreationCallout:completion:]_block_invoke + 288
41 FrontBoardServices             0x9834 -[FBSScene _callOutQueue_coalesceClientSettingsUpdates:] + 68
42 FrontBoardServices             0xb794 -[FBSScene _callOutQueue_didCreateWithTransitionContext:alternativeCreationCallout:completion:] + 436
43 FrontBoardServices             0x1fc94 __93-[FBSWorkspaceScenesClient _callOutQueue_sendDidCreateForScene:transitionContext:completion:]_block_invoke.197 + 276
44 FrontBoardServices             0x1f4c8 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 168
45 FrontBoardServices             0x2eb90 -[FBSWorkspaceScenesClient _callOutQueue_sendDidCreateForScene:transitionContext:completion:] + 468
46 libdispatch.dylib              0x3fa8 _dispatch_client_callout + 20
47 libdispatch.dylib              0x79f0 _dispatch_block_invoke_direct + 284
48 FrontBoardServices             0x18378 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 52
49 FrontBoardServices             0x182f8 -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible] + 240
50 FrontBoardServices             0x181d0 -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource] + 28
51 CoreFoundation                 0x73f3c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28
52 CoreFoundation                 0x73ed0 __CFRunLoopDoSource0 + 176
53 CoreFoundation                 0x76b30 __CFRunLoopDoSources0 + 244
54 CoreFoundation                 0x75d2c __CFRunLoopRun + 840
55 CoreFoundation                 0xc8274 CFRunLoopRunSpecific + 588
56 GraphicsServices               0x14c0 GSEventRunModal + 164
57 UIKitCore                      0x3ee77c -[UIApplication _run] + 816
58 UIKitCore                      0x14e64 UIApplicationMain + 340
59 kmbmobile                      0x122ac main + 8 (main.m:8)
60 ???                            0x1b08ecde8 (Missing)

com.apple.UIKit.KeyboardManagement
0  libsystem_kernel.dylib         0x7bd0 __ulock_wait + 8
1  libdispatch.dylib              0x4998 _dlock_wait + 56
2  libdispatch.dylib              0x474c _dispatch_thread_event_wait_slow + 56
3  libdispatch.dylib              0x13ae8 __DISPATCH_WAIT_FOR_QUEUE__ + 368
4  libdispatch.dylib              0x13694 _dispatch_sync_f_slow + 148
5  UIKitCore                      0x3f0594 __37-[_UIRemoteKeyboards startConnection]_block_invoke_3 + 144
6  CoreFoundation                 0x2fe24 __invoking___ + 148
7  CoreFoundation                 0x2ee6c -[NSInvocation invoke] + 428
8  Foundation                     0xb7564 __NSXPCCONNECTION_IS_CALLING_OUT_TO_EXPORTED_OBJECT__ + 16
9  Foundation                     0xb5f98 -[NSXPCConnection _decodeAndInvokeReplyBlockWithEvent:sequence:replyInfo:] + 532
10 Foundation                     0xb8fc0 __88-[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:]_block_invoke_5 + 188
11 libxpc.dylib                   0x1fc40 _xpc_connection_reply_callout + 116
12 libxpc.dylib                   0x12390 _xpc_connection_call_reply_async + 80
13 libdispatch.dylib              0x4028 _dispatch_client_callout3 + 20
14 libdispatch.dylib              0x21b64 _dispatch_mach_msg_async_reply_invoke + 340
15 libdispatch.dylib              0xb42c _dispatch_lane_serial_drain + 352
16 libdispatch.dylib              0xc158 _dispatch_lane_invoke + 432
17 libdispatch.dylib              0x1738c _dispatch_root_queue_drain_deferred_wlh + 288
18 libdispatch.dylib              0x16bd8 _dispatch_workloop_worker_thread + 540
19 libsystem_pthread.dylib        0x3680 _pthread_wqthread + 288
20 libsystem_pthread.dylib        0x1474 start_wqthread + 8

Project Files

Javascript

Click To Expand

package.json:

"@react-native-firebase/analytics": "20.5.0",
"@react-native-firebase/app": "20.5.0",
"@react-native-firebase/crashlytics": "20.5.0",
"@react-native-firebase/dynamic-links": "20.5.0",
"@react-native-firebase/messaging": "20.5.0",
"@react-native-firebase/perf": "20.5.0",

firebase.json for react-native-firebase v6:

{
    "react-native": {
      "crashlytics_debug_enabled": false,
      "crashlytics_is_error_generation_on_js_crash_enabled": true,
      "crashlytics_javascript_exception_handler_chaining_enabled": true
    }
  }

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
  pod 'FirebaseCrashlytics'

AppDelegate.m:

  [FIRApp configure];


Android

Click To Expand

Have you converted to AndroidX?

  • my application is an AndroidX application?
  • I am using android/gradle.settings jetifier=true for Android compatibility?
  • I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

System:
  OS: macOS 14.6.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 54.13 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.16.0
    path: /opt/homebrew/opt/node@20/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.8.1
    path: /opt/homebrew/opt/node@20/bin/npm
  Watchman:
    version: 2024.08.12.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.1
      - iOS 18.1
      - macOS 15.1
      - tvOS 18.1
      - visionOS 2.1
      - watchOS 11.1
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11330709
  Xcode:
    version: 16.1/16B40
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.7
    path: /usr/bin/javac
  Ruby:
    version: 3.3.4
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 13.6.9
    wanted: ^13.6.3
  react:
    installed: 18.2.0
    wanted: ^18.2.0
  react-native:
    installed: 0.72.14
    wanted: 0.72.14
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found```

<!-- change `[ ]` to `[x]` to select an option(s) -->

- **Platform that you're experiencing the issue on**:
  - [ ] iOS
  - [ ] Android
  - [ ] **iOS** but have not tested behavior on Android
  - [ ] **Android** but have not tested behavior on iOS
  - [ ] Both
- **`react-native-firebase` version you're using that has this issue:**
  - `e.g. 5.4.3`
- **`Firebase` module(s) you're using that has the issue:**
  - `e.g. Instance ID`
- **Are you using `TypeScript`?**
  - `Y/N` & `VERSION`

</p>
</details>

<!-- Thanks for reading this far down ❤️  -->
<!-- High quality, detailed issues are much easier to triage for maintainers -->

<!-- For bonus points, if you put a 🔥 (:fire:) emojii at the start of the issue title we'll know -->
<!-- that you took the time to fill this out correctly, or, at least read this far -->

---

- 👉 Check out [`React Native Firebase`](https://twitter.com/rnfirebase) and [`Invertase`](https://twitter.com/invertaseio) on Twitter for updates on the library.
@mikehardy
Copy link
Collaborator

Hi there!

  • If you are posting a crash please post the relevant stack trace
  • Please do not post issues on outdated versions, update to current then reproduce in order to harvest the stack trace for examination

@mikehardy
Copy link
Collaborator

Also, this is a deliberate incomplete posting of information requested, which will likely lead to an incomplete effort to help - most likely not your desired outcome - suggest posting full contents:

Image

@mikehardy
Copy link
Collaborator

I think we're going to need a reproduction for this one posted as a github repo we could clone and run to reproduce it

Why? As near as I can tell, the only uses of that collection should be safe in this context?

They are all here:

https://github.com/search?q=repo%3Afirebase%2Ffirebase-ios-sdk%20originalAppDelegateImps&type=code

I used a question mark because it should be the case multiple threads aren't going through there at once - the only time I could imagine that happening is if there was a race between init and dealloc somehow? Which seems tremendously unlikely and even then likely a coding error somehow ? (perhaps a notifications extension helper or something?

Would be useful along with a reproduction to know the frequency of this crash versus crash-free sessions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants