E470 remote config realtime listeners not removed · Issue #11458 · firebase/firebase-ios-sdk · GitHub
[go: up one dir, main page]

Skip to content

remote config realtime listeners not removed #11458

@mikehardy

Description

@mikehardy

Description

It appears something is happening with the object equality of the listeners such that they are registered, and you can iterate over them with updates correctly sent, but when you go to remove them the listener is not found in the listeners set so it is not actually removed

I noticed odd behavior during the react-native-firebase implementation (invertase/react-native-firebase#7119) where I was getting more events than expected

I reached this conclusion by adding a bunch of logging prefixed with FirebaseRemoteConfig see snippet below

Hypothesis - either the wrong object is sent in to the remove call so it matches no listeners, or the listener address itself is somehow mutated while going into the dispatch_async block such that the set of listeners has slightly different addresses for the listener than that which is encapsulated in the registration's completion handler and thus isn't equal later when calling remove

Reproducing the issue

I think you can just add a listener, check the listeners count, remove the listener, then check the count again.

Firebase SDK Version

10.11.0

Xcode Version

14.3.1

Installation Method

CocoaPods

Firebase Product(s)

Remote Config

Targeted Platforms

iOS

Relevant Log Output

2023-06-19 15:17:00.104 Df testing[17169:26e92] RNFirebaseRemoteConfig onConfigUpdated called
2023-06-19 15:17:00.104 Df testing[17169:26e92] RNFirebaseRemoteConfig onConfigUpdated no native listener for this app yet. Registering native listener.
2023-06-19 15:17:00.105 Df testing[17169:26e92] FirebaseRemoteConfig addConfigUpdateListener called on <__NSMallocBlock__: 0x600003d6f1e0>
2023-06-19 15:17:00.106 Df testing[17169:26f13] FirebaseRemoteConfig addConfigUpdateListener added <__NSMallocBlock__: 0x600003c83d50>, count now 1
2023-06-19 15:17:00.106 Df testing[17169:26e92] FirebaseRemoteConfig listener creation, self is <FIRConfigUpdateListenerRegistration: 0x6000033558a0> / completionHandler is <__NSMallocBlock__: 0x600003c83780>
2023-06-19 15:17:00.106 Df testing[17169:26e92] FirebaseRemoteConfig addConfigUpdateListener returning FIRConfigUpdateListenerRegistration <FIRConfigUpdateListenerRegistration: 0x6000033558a0>
2023-06-19 15:17:00.109 Db testing[17169:27098] (Detox) 10.11.0 - [FirebaseRemoteConfig][I-RCN000039] Starting requesting token.
2023-06-19 15:17:00.130 I  testing[17169:27098] (Detox) 10.11.0 - [FirebaseRemoteConfig][I-RCN000022] Success to get iid : fVOpA6F880YiqXMzcImg5a.
2023-06-19 15:17:12.736 Df testing[17169:26e92] FirebaseRemoteConfig evaluateStreamResponse - fetch version 556
2023-06-19 15:17:12.736 Df testing[17169:26e92] FirebaseRemoteConfig autoFetch - fetch version 556
2023-06-19 15:17:12.736 Db testing[17169:26f4f] (Detox) 10.11.0 - [FirebaseRemoteConfig][I-RCN000015] Received config update message on stream.
2023-06-19 15:17:13.805 Db testing[17169:27098] (Detox) 10.11.0 - [FirebaseRemoteConfig][I-RCN000039] Starting requesting token.
2023-06-19 15:17:13.807 I  testing[17169:27098] (Detox) 10.11.0 - [FirebaseRemoteConfig][I-RCN000022] Success to get iid : fVOpA6F880YiqXMzcImg5a.
2023-06-19 15:17:13.808 Db testing[17169:27098] (Detox) 10.11.0 - [FirebaseRemoteConfig][I-RCN000060] Fetch with user properties completed.
2023-06-19 15:17:13.809 Db testing[17169:27098] (Detox) 10.11.0 - [FirebaseRemoteConfig][I-RCN000061] Fetch with user properties initiated.
2023-06-19 15:17:13.812 Db testing[17169:27098] (Detox) 10.11.0 - [FirebaseRemoteConfig][I-RCN000040] Start config fetch.
2023-06-19 15:17:13.812 Db testing[17169:27098] (Detox) 10.11.0 - [FirebaseRemoteConfig][I-RCN000061] Making remote config fetch.
2023-06-19 15:17:13.813 Db testing[17169:27098] (Detox) 10.11.0 - [FirebaseRemoteConfig][I-RCN000046] Making config request: https://firebaseremoteconfig.googleapis.com/v1/projects/react-native-firebase-testing/namespaces/firebase:fetch?key=AIzaSyAHAsf51D0A407EklG1bs-5wA7EbyfNFg0
2023-06-19 15:17:14.297 Db testing[17169:26f96] (Detox) 10.11.0 - [FirebaseRemoteConfig][I-RCN000050] config fetch completed. Error: nil StatusCode: 200
2023-06-19 15:17:14.297 Db testing[17169:26f96] (Detox) 10.11.0 - [FirebaseRemoteConfig][I-RCN000059] Updating config content from Response for namespace:firebase:__FIRAPP_DEFAULT with state: UPDATE
2023-06-19 15:17:14.299 Db testing[17169:26f96] (Detox) 10.11.0 - [FirebaseRemoteConfig][I-RCN000058] Update config in DB for namespace:firebase:__FIRAPP_DEFAULT
2023-06-19 15:17:14.301 Db testing[17169:27098] (Detox) 10.11.0 - [FirebaseRemoteConfig][I-RCN000056] Updating metadata with fetch result.
2023-06-19 15:17:14.389 Df testing[17169:26e92] FirebaseRemoteConfig - triggering 1 listeners
2023-06-19 15:17:14.399 Df testing[17169:26e92] FirebaseRemoteConfig - triggering listener <__NSMallocBlock__: 0x600003c83d50>
2023-06-19 15:17:14.405 Df testing[17169:26e92] RNFirebaseRemoteConfig onConfigUpdated event {
2023-06-19 15:17:14.588 Df testing[17169:26e92] RNFirebaseRemoteConfig removeConfigUpdateRegistration called
2023-06-19 15:17:14.589 Df testing[17169:26e92] RNFirebaseRemoteConfig there is a native listener for this app. Removing it.
2023-06-19 15:17:14.589 Df testing[17169:26e92] FirebaseRemoteConfig SDK listener removal, self is <FIRConfigUpdateListenerRegistration: 0x6000033558a0> / completionHandler is <__NSMallocBlock__: 0x600003c83780>
2023-06-19 15:17:14.589 Df testing[17169:26e92] FirebaseRemoteConfig removeConfigUpdateListener called on <__NSMallocBlock__: 0x600003c83780>
2023-06-19 15:17:14.590 Df testing[17169:26f4f] FirebaseRemoteConfig removeConfigUpdateListener <__NSMallocBlock__: 0x600003c83780>, before count 1
2023-06-19 15:17:14.590 Df testing[17169:26f4f] FirebaseRemoteConfig removeConfigUpdateListener, after count 1

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0