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

bug: setup of snaphsot listeners leads to crash on iOS #798

Closed
5 of 17 tasks
BoveFabio opened this issue Jan 17, 2025 · 4 comments
Closed
5 of 17 tasks

bug: setup of snaphsot listeners leads to crash on iOS #798

BoveFabio opened this issue Jan 17, 2025 · 4 comments
Labels

Comments

@BoveFabio
Copy link

Plugin(s)

  • Analytics
  • App
  • App Check
  • Authentication
  • Crashlytics
  • Cloud Firestore
  • Cloud Functions
  • Cloud Messaging
  • Cloud Storage
  • Performance
  • Remote Config

Version

6.3.1

Platform(s)

  • Android
  • iOS
  • Web

Current behavior

When I set up (multiple) snapshot listeners in parallel, the iOS crashes randomly with varying errors. Among them are:

  • Thread 4: "-[__NSCFNumber count]: unrecognized selector sent to instance 0x8000000000000000"
  • Thread 8: "-[NSTaggedPointerString count]: unrecognized selector sent to instance 0x8000000000000000"
  • Thread 17: EXC_BAD_ACCESS (code=1, address=0x10)

XCode shows me an error in L244 in @capacitor-firebase/firestore/ios/Plugin/FirebaseFirestore.swift

self.listenerRegistrationMap[callbackId] = listenerRegistration

Unfortunately, I have no clue about Swift development, so I'm rather helpless with this.

Given that this happens in a very simple setup (see attached repo for a minimal reproduction), I am inclined to say that I am not using the plugin in a way it is not intended to be used.

Any feedback on this would be great!

Expected behavior

Setting up snapshot listeners should not lead to crashes.

Reproduction

https://github.com/BoveFabio/capawesome-firestore-reproduction

Steps to reproduce

Check out the attached repo, then:

  1. npm i
  2. npm run build
  3. Replace [your local IP] inside the capacitor.config.ts
  4. npx cap sync
  5. Add firebase config as described in the docs: https://github.com/capawesome-team/capacitor-firebase/blob/main/docs/firebase-setup.md#ios
  6. npm run dev -- --host
  7. Start the app on any emulator or real device
  8. Play around with numberOfSnapshotListeners in App.tsx
  9. Observe the error in XCode (file @capacitor-firebase/firestore/ios/Plugin/FirebaseFirestore.swift, e.g. img.png)

Other information

No response

Capacitor doctor

❯ npx cap doctor
💊 Capacitor Doctor 💊

Latest Dependencies:

@capacitor/cli: 6.2.0
@capacitor/core: 6.2.0
@capacitor/android: 6.2.0
@capacitor/ios: 6.2.0

Installed Dependencies:

@capacitor/cli: 6.2.0
@capacitor/core: 6.2.0
@capacitor/android: 6.2.0
@capacitor/ios: 6.2.0

[success] iOS looking great! 👌
[success] Android looking great! 👌

Before submitting

  • I have read and followed the bug report guidelines.
  • I have attached links to possibly related issues and discussions.
  • I understand that incomplete issues (e.g. without reproduction) are closed.
@BoveFabio BoveFabio added bug/fix Something isn't working needs: triage labels Jan 17, 2025
@robingenz
Copy link
Member

Thank you reaching out. This issue should be a duplicate of #771. Feel free to give our latest pre-release a try:

npm i https://pkg.pr.new/capawesome-team/capacitor-firebase/@capacitor-firebase/firestore@0bffff0

@BoveFabio
Copy link
Author

Sorry for that! I swear I searched issues and discussions beforehand 🫣

Thanks, I'll check it out.

@Mortenjoe
Copy link

Not to hijack the issue but I had similar issue which also sounds like the one mentioned in #771. My app sometimes crashed while creating multiple snapshot listeners with an EXC_BAD_ACCESS pointing to the snapshot listeners. After installing the suggested prerelease i've had no crashes! Seems to work for me :-)

Best regards

Morten

@robingenz
Copy link
Member

Thank you. I will close this issue for now.

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

No branches or pull requests

3 participants