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

Remote Config randomly returns wrong values

Open cnpatric opened this issue 10 months ago • 5 comments

Description

We used RemoteConfig for a feature flag on our web and iOS clients. This feature flag was a boolean and set to false by default. After release of the app we noticed that roughly 200 of our roughly 10k users have this flag enabled for some reason. We tried to track down how this could happen, checked the remote config history for accidental enabling of it, quadruple checked the code snippet that checks for this flag but were unable to figure out how those users can have this flag enabled.

The only users that are affected here are iOS users, despite having the same setup in our web clients. The only thing we ever did was enable this flag for specific installation ids.

We assume that the only possibility right now is that the sdk returns a wrong value here.

Reproducing the issue

We were unable to reproduce this so far, we can just see that it is happening trough our logs.

Firebase SDK Version

10.14

Xcode Version

14

Installation Method

Swift Package Manager

Firebase Product(s)

Remote Config

Targeted Platforms

iOS

Relevant Log Output

No response

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

Expand Package.resolved snippet

{
  "pins" : [
    {
      "identity" : "abseil-cpp-binary",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/abseil-cpp-binary.git",
      "state" : {
        "revision" : "bfc0b6f81adc06ce5121eb23f628473638d67c5c",
        "version" : "1.2022062300.0"
      }
    },
    {
      "identity" : "alamofire",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/Alamofire/Alamofire",
      "state" : {
        "revision" : "d120af1e8638c7da36c8481fd61a66c0c08dc4fc",
        "version" : "5.4.4"
      }
    },
    {
      "identity" : "appauth-ios",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/openid/AppAuth-iOS.git",
      "state" : {
        "revision" : "71cde449f13d453227e687458144bde372d30fc7",
        "version" : "1.6.2"
      }
    },
    {
      "identity" : "audioplayer",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/delannoyk/AudioPlayer",
      "state" : {
        "branch" : "develop",
        "revision" : "a4e807c08a0796fca29e72d42614ce3703009517"
      }
    },
    {
      "identity" : "auth0.swift",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/auth0/Auth0.swift.git",
      "state" : {
        "revision" : "ed8079f27b32f3fc96b6c3dcc5e9e5a1dd68e247",
        "version" : "1.39.1"
      }
    },
    {
      "identity" : "collectionconcurrencykit",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/JohnSundell/CollectionConcurrencyKit.git",
      "state" : {
        "revision" : "b4f23e24b5a1bff301efc5e70871083ca029ff95",
        "version" : "0.2.0"
      }
    },
    {
      "identity" : "craftnote-ios-logging",
      "kind" : "remoteSourceControl",
      "location" : "[email protected]:craftnote/craftnote-ios-logging.git",
      "state" : {
        "branch" : "main",
        "revision" : "5906b4dc12ad3f10f402dcc76f2d9917241aaf98"
      }
    },
    {
      "identity" : "cryptoswift",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/krzyzanowskim/CryptoSwift.git",
      "state" : {
        "revision" : "32f641cf24fc7abc1c591a2025e9f2f572648b0f",
        "version" : "1.7.2"
      }
    },
    {
      "identity" : "devicekit",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/devicekit/DeviceKit",
      "state" : {
        "revision" : "691fe8112cca20ebf0020a1709d4e0205400311c",
        "version" : "5.0.0"
      }
    },
    {
      "identity" : "facebook-ios-sdk",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/facebook/facebook-ios-sdk",
      "state" : {
        "revision" : "7fd8a930a5b2c940a22efafe0e214ed0df671312",
        "version" : "15.1.0"
      }
    },
    {
      "identity" : "filekit",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/nvzqz/FileKit",
      "state" : {
        "revision" : "8b023fb42c2afd8a9ca00d2e587e1619a4ce8b5c",
        "version" : "5.3.0"
      }
    },
    {
      "identity" : "firebase-ios-sdk",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/firebase-ios-sdk",
      "state" : {
        "revision" : "2bfe6abe1014aafe5cf28401708f7d39f9926a76",
        "version" : "10.14.0"
      }
    },
    {
      "identity" : "googleappmeasurement",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleAppMeasurement.git",
      "state" : {
        "revision" : "03b9beee1a61f62d32c521e172e192a1663a5e8b",
        "version" : "10.13.0"
      }
    },
    {
      "identity" : "googledatatransport",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleDataTransport.git",
      "state" : {
        "revision" : "aae45a320fd0d11811820335b1eabc8753902a40",
        "version" : "9.2.5"
      }
    },
    {
      "identity" : "googlesignin-ios",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleSignIn-iOS",
      "state" : {
        "revision" : "9c9b36af86a4dd3da16048a36cf37351e63ccfe1",
        "version" : "6.2.4"
      }
    },
    {
      "identity" : "googleutilities",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleUtilities.git",
      "state" : {
        "revision" : "c38ce365d77b04a9a300c31061c5227589e5597b",
        "version" : "7.11.5"
      }
    },
    {
      "identity" : "grdb.swift",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/groue/GRDB.swift.git",
      "state" : {
        "revision" : "e40569844f51d21222b7f858cfbcca47d200b79b",
        "version" : "6.17.0"
      }
    },
    {
      "identity" : "grpc-binary",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/grpc-binary.git",
      "state" : {
        "revision" : "f1b366129d1125be7db83247e003fc333104b569",
        "version" : "1.50.2"
      }
    },
    {
      "identity" : "gtm-session-fetcher",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/gtm-session-fetcher.git",
      "state" : {
        "revision" : "5ccda3981422a84186387dbb763ba739178b529c",
        "version" : "2.3.0"
      }
    },
    {
      "identity" : "gtmappauth",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GTMAppAuth.git",
      "state" : {
        "revision" : "6dee0cde8a1b223737a5159e55e6b4ec16bbbdd9",
        "version" : "1.3.1"
      }
    },
    {
      "identity" : "hgcircularslider",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/HamzaGhazouani/HGCircularSlider",
      "state" : {
        "revision" : "2b98462d32bf7211851aa73537dbaba5dd80229e",
        "version" : "2.2.1"
      }
    },
    {
      "identity" : "interop-ios-for-google-sdks",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/interop-ios-for-google-sdks.git",
      "state" : {
        "revision" : "2d12673670417654f08f5f90fdd62926dc3a2648",
        "version" : "100.0.0"
      }
    },
    {
      "identity" : "ios-snapshot-test-case",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/uber/ios-snapshot-test-case",
      "state" : {
        "revision" : "7b10770333a961be6e5a41c9ce04b8c6d3990126",
        "version" : "8.0.0"
      }
    },
    {
      "identity" : "ios_sdk",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/adjust/ios_sdk",
      "state" : {
        "revision" : "f129fbc84962c6bc2442c366cbdf0070ec76de2e",
        "version" : "4.34.1"
      }
    },
    {
      "identity" : "iqkeyboardmanager",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/hackiftekhar/IQKeyboardManager.git",
      "state" : {
        "revision" : "ea08e08958890043019d248065fe3d825f338087",
        "version" : "6.5.12"
      }
    },
    {
      "identity" : "jwtdecode.swift",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/auth0/JWTDecode.swift.git",
      "state" : {
        "revision" : "3cd207fb9e943b6168a117baa3936c823204c2dc",
        "version" : "2.6.3"
      }
    },
    {
      "identity" : "kdcircularprogress",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/kaandedeoglu/KDCircularProgress",
      "state" : {
        "revision" : "a0f30e0605b7ac91ac1b243efd9914b3fd592ad3",
        "version" : "1.5.4"
      }
    },
    {
      "identity" : "kingfisher",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/onevcat/Kingfisher",
      "state" : {
        "revision" : "b6f62758f21a8c03cd64f4009c037cfa580a256e",
        "version" : "7.9.1"
      }
    },
    {
      "identity" : "leveldb",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/leveldb.git",
      "state" : {
        "revision" : "0706abcc6b0bd9cedfbb015ba840e4a780b5159b",
        "version" : "1.22.2"
      }
    },
    {
      "identity" : "lottie-spm",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/airbnb/lottie-spm",
      "state" : {
        "revision" : "60ea4f82fba8b4cb21a75665a889e86ed4d81c6e",
        "version" : "4.2.0"
      }
    },
    {
      "identity" : "material-components-ios",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/robinschmied/material-components-ios",
      "state" : {
        "branch" : "develop",
        "revision" : "c6b51ffd60ef803b37f2f79f19509d4f74c46606"
      }
    },
    {
      "identity" : "material-internationalization-ios",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/Lilfaen/material-internationalization-ios",
      "state" : {
        "branch" : "develop",
        "revision" : "091636408334abc6d068684fd64fcccfbf49de7c"
      }
    },
    {
      "identity" : "material-text-accessibility-ios",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/Lilfaen/material-text-accessibility-ios",
      "state" : {
        "branch" : "develop",
        "revision" : "6d1d4b985264be125234644e0c8299c84de8e6dd"
      }
    },
    {
      "identity" : "nanopb",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/nanopb.git",
      "state" : {
        "revision" : "819d0a2173aff699fb8c364b6fb906f7cdb1a692",
        "version" : "2.30909.0"
      }
    },
    {
      "identity" : "pkhud",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/pkluz/PKHUD",
      "state" : {
        "revision" : "8fd26f23057c6bebd6695524b1c3e05e93aba571",
        "version" : "5.4.0"
      }
    },
    {
      "identity" : "promises",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/promises.git",
      "state" : {
        "revision" : "e70e889c0196c76d22759eb50d6a0270ca9f1d9e",
        "version" : "2.3.1"
      }
    },
    {
      "identity" : "pspdfkit-sp",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/PSPDFKit/PSPDFKit-SP",
      "state" : {
        "revision" : "612f0c3e86a8a6c5a9fac87da9b990ce836c3214",
        "version" : "12.3.0"
      }
    },
    {
      "identity" : "r.swift",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/mac-cain13/R.swift",
      "state" : {
        "revision" : "0e4ec17f329136b712d0a96128597b8ff2f31bdc",
        "version" : "7.3.2"
      }
    },
    {
      "identity" : "scanbot-sdk-ios-spm",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/doo/scanbot-sdk-ios-spm",
      "state" : {
        "revision" : "54560eb7dd7c6e24f3eeff77e2ea7444489f83ce",
        "version" : "1.24.0"
      }
    },
    {
      "identity" : "sfsafesymbols",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/SFSafeSymbols/SFSafeSymbols.git",
      "state" : {
        "revision" : "7cca2d60925876b5953a2cf7341cd80fbeac983c",
        "version" : "4.1.1"
      }
    },
    {
      "identity" : "simplekeychain",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/auth0/SimpleKeychain.git",
      "state" : {
        "revision" : "b355c569efcd409e252ccbb500d9fc2713b4d64d",
        "version" : "0.12.5"
      }
    },
    {
      "identity" : "siren",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/ArtSabintsev/Siren",
      "state" : {
        "revision" : "dfee0e0e29ce3b1dcb138dd467a3580e3380f579",
        "version" : "6.1.2"
      }
    },
    {
      "identity" : "socket.io-client-swift",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/socketio/socket.io-client-swift",
      "state" : {
        "revision" : "175da8b5156f6b132436f0676cc84c2f6a766b6e",
        "version" : "16.1.0"
      }
    },
    {
      "identity" : "sourcekitten",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/jpsim/SourceKitten.git",
      "state" : {
        "revision" : "b6dc09ee51dfb0c66e042d2328c017483a1a5d56",
        "version" : "0.34.1"
      }
    },
    {
      "identity" : "starscream",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/daltoniam/Starscream",
      "state" : {
        "revision" : "ac6c0fc9da221873e01bd1a0d4818498a71eef33",
        "version" : "4.0.6"
      }
    },
    {
      "identity" : "swift-argument-parser",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-argument-parser.git",
      "state" : {
        "revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531",
        "version" : "1.2.3"
      }
    },
    {
      "identity" : "swift-collections",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-collections.git",
      "state" : {
        "revision" : "937e904258d22af6e447a0b72c0bc67583ef64a2",
        "version" : "1.0.4"
      }
    },
    {
      "identity" : "swift-log",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-log.git",
      "state" : {
        "revision" : "532d8b529501fb73a2455b179e0bbb6d49b652ed",
        "version" : "1.5.3"
      }
    },
    {
      "identity" : "swift-log-syslog",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/ianpartridge/swift-log-syslog.git",
      "state" : {
        "branch" : "master",
        "revision" : "cc19c41bcb53f4ccf64405e6f4a2951a467f973d"
      }
    },
    {
      "identity" : "swift-protobuf",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-protobuf.git",
      "state" : {
        "revision" : "ce20dc083ee485524b802669890291c0d8090170",
        "version" : "1.22.1"
      }
    },
    {
      "identity" : "swift-sdk",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/iterable/swift-sdk",
      "state" : {
        "revision" : "84caa3d2570ad7cbf70b64d7875ae850a7ca551c",
        "version" : "6.4.15"
      }
    },
    {
      "identity" : "swift-syntax",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-syntax.git",
      "state" : {
        "revision" : "59ed009d2c4a5a6b78f75a25679b6417ac040dcf",
        "version" : "509.0.0-swift-DEVELOPMENT-SNAPSHOT-2023-07-04-a"
      }
    },
    {
      "identity" : "swiftlint",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/realm/SwiftLint",
      "state" : {
        "revision" : "9eaecbedce469a51bd8487effbd4ab46ec8384ae",
        "version" : "0.52.4"
      }
    },
    {
      "identity" : "swiftlocation",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/malcommac/SwiftLocation.git",
      "state" : {
        "revision" : "0738a53d828ac3bede72b718af18a915ff1ed27d",
        "version" : "4.2.0"
      }
    },
    {
      "identity" : "swiftmessages",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/SwiftKickMobile/SwiftMessages",
      "state" : {
        "revision" : "b29dd21090b708aa0ae9ecbaf6e2d0487028dc3f",
        "version" : "9.0.6"
      }
    },
    {
      "identity" : "swiftstate",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/ReactKit/SwiftState",
      "state" : {
        "revision" : "887e75b96da6be36a062e1b0ef832c32a803348b",
        "version" : "6.0.1"
      }
    },
    {
      "identity" : "swiftui-introspect",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/siteline/SwiftUI-Introspect.git",
      "state" : {
        "revision" : "121c146fe591b1320238d054ae35c81ffa45f45a",
        "version" : "0.12.0"
      }
    },
    {
      "identity" : "swiftytexttable",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/scottrhoyt/SwiftyTextTable.git",
      "state" : {
        "revision" : "c6df6cf533d120716bff38f8ff9885e1ce2a4ac3",
        "version" : "0.9.0"
      }
    },
    {
      "identity" : "swiftyuserdefaults",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/sunshinejr/SwiftyUserDefaults",
      "state" : {
        "revision" : "f66bcd04088582c8fbb5cb8554d577e303bae396",
        "version" : "5.3.0"
      }
    },
    {
      "identity" : "swinject",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/Swinject/Swinject",
      "state" : {
        "revision" : "8bc503e60965298984fb58cf47b71c541449fe2a",
        "version" : "2.8.3"
      }
    },
    {
      "identity" : "swinjectstoryboard",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/Swinject/SwinjectStoryboard.git",
      "state" : {
        "revision" : "e4498ce2dfe37e1ca9d2d20af06fcc087507561c",
        "version" : "2.2.3"
      }
    },
    {
      "identity" : "swxmlhash",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/drmohundro/SWXMLHash.git",
      "state" : {
        "revision" : "a853604c9e9a83ad9954c7e3d2a565273982471f",
        "version" : "7.0.2"
      }
    },
    {
      "identity" : "taglistview",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/ElaWorkshop/TagListView",
      "state" : {
        "revision" : "b30b61826736f4d9ec04aef5df891f3914423f16",
        "version" : "1.4.1"
      }
    },
    {
      "identity" : "tocropviewcontroller",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/TimOliver/TOCropViewController",
      "state" : {
        "revision" : "d0470491f56e734731bbf77991944c0dfdee3e0e",
        "version" : "2.6.1"
      }
    },
    {
      "identity" : "tttattributedlabel",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/mstfy/TTTAttributedLabel",
      "state" : {
        "branch" : "spm-support",
        "revision" : "a38fcd41afad4ad3a4b00e28a4505c6936b02b99"
      }
    },
    {
      "identity" : "uitextview-placeholder",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/iAllenC/UITextView-Placeholder",
      "state" : {
        "revision" : "35f7d473078db92917d6eb6b62b78f1c53abc92d",
        "version" : "1.4.1"
      }
    },
    {
      "identity" : "xcodeedit",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/tomlokhorst/XcodeEdit",
      "state" : {
        "revision" : "cd466d6e8c5ffd2f2b61165d37b0646f09068e1e",
        "version" : "2.9.0"
      }
    },
    {
      "identity" : "yams",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/jpsim/Yams.git",
      "state" : {
        "revision" : "0d9ee7ea8c4ebd4a489ad7a73d5c6cad55d6fed3",
        "version" : "5.0.6"
      }
    }
  ],
  "version" : 2
}

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet

Replace this line with the contents of your Podfile.lock!

cnpatric avatar Oct 11 '23 13:10 cnpatric

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

google-oss-bot avatar Oct 11 '23 13:10 google-oss-bot

Hi @cnpatric, I tried to reproduce the issue, but I'm able to get the correct value even when I enabled the flag to a specific installation ID. With this, we'll likely need an MCVE and the condition you set in the console to reproduce the issue and to investigate.

rizafran avatar Oct 19 '23 09:10 rizafran

Unfortunately the code for the remote config is pretty nested so it is a bit more complicated to provide a MCVE. Is there anything else could give you to track this down?

What we found so far is that the remote config with the flag had already been added way before the iOS release happened. As soon as iOS released and was calling the config we saw a small percentage of users getting the wrong config value.

We use the listener of the SDK to check for real time changes and get the config on app start. We initially assumed this could be related to the amount of users calling the remote config api at once after release but we saw no spike of users with access on the release day, instead we had new users with access pop up randomly over the last two weeks.

I assume this one might be pretty hard to track down and it does not cause any immediate problems but I"m reasonably certain that there is an issue with either the remoteconfig or the SDK. From the closed tickets I can see this was not the first time this happened and according to stackoverflow (see comments) it is happening to others relativy recently.

Let me know if I can help with anything but an MCVE.

cnpatric avatar Oct 20 '23 11:10 cnpatric

Unfortunately the code for the remote config is pretty nested so it is a bit more complicated to provide a MCVE. Is there anything else could give you to track this down?

What we found so far is that the remote config with the flag had already been added way before the iOS release happened. As soon as iOS released and was calling the config we saw a small percentage of users getting the wrong config value.

We use the listener of the SDK to check for real time changes and get the config on app start. We initially assumed this could be related to the amount of users calling the remote config api at once after release but we saw no spike of users with access on the release day, instead we had new users with access pop up randomly over the last two weeks.

I assume this one might be pretty hard to track down and it does not cause any immediate problems but I"m reasonably certain that there is an issue with either the remoteconfig or the SDK. From the closed tickets I can see this was not the first time this happened and according to stackoverflow (see comments) it is happening to others relativy recently.

Let me know if I can help with anything but an MCVE.

Is this resolved? Can you please confirm the Firebase SDK version you are using ?

PuneethiOS avatar Dec 21 '23 22:12 PuneethiOS

We encountered the same issue - the flag was set to false except for some installation IDs. In the past, before the release, it was set to true for testing purposes. We fetch the values whenever possible (when cache is expired) and in case of failed fetch or no connection we return null that is unwrapped to false. Yet still, several days after the release, there are users with the flag set to true.

Firebase SDK Version: 10.4

InkyTsar avatar Apr 12 '24 14:04 InkyTsar