firebase / firebase/firebase-ios-sdk

RCNConfigRealtime trying to connect while in background

Open
#15,737 3 comments 0 reactions 0 assignees View on GitHub
api: remoteconfig
Dominant language
C++
Stars
6.7k
Forks
1.8k
Avg merge
2d 18h
Merged PRs (30d)
75

Description

### Description

In `[RCNConfigRealtime retryHTTPConnection]` there's some early return:

```objective-c
// Retry mechanism for HTTP connections
- (void)retryHTTPConnection {
__weak RCNConfigRealtime *weakSelf = self;
dispatch_async(_realtimeLockQueue, ^{
__strong RCNConfigRealtime *strongSelf = weakSelf;
if (!strongSelf || strongSelf->_isInBackground) {
return;
}
```

This doesn't seem to work reliably. We have millions of non-fatals on Crashlytics that run into `FIRRemoteConfigUpdateErrorStreamError` and 99% of them report that the app is in background.

Image

### Reproducing the issue

Unfortunately we don't have any steps on how to reproduce this, but in the screenshot above you can see that it happens very often on production.

### Firebase SDK Version

12.7.0

### Xcode Version

26.2

### Installation Method

Swift Package Manager

### Firebase Product(s)

Remote Config

### Targeted Platforms

iOS

### Relevant Log Output

```shell
Non-fatal: Error
Domain: com.google.remoteconfig.update.ErrorDomain Code: 8001 NSLocalizedDescription: Unable to connect to the server. Check your connection and try again.
```

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

Expand Package.resolved snippet

```json

{
"pins" : [
{
"identity" : "abseil-cpp-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/abseil-cpp-binary.git",
"state" : {
"revision" : "bbe8b69694d7873315fd3a4ad41efe043e1c07c5",
"version" : "1.2024072200.0"
}
},
{
"identity" : "accessibilitysnapshot",
"kind" : "remoteSourceControl",
"location" : "https://github.com/cashapp/AccessibilitySnapshot.git",
"state" : {
"revision" : "8d4bc42c1ba23755147b931e1e94c775df91a997",
"version" : "0.10.0"
}
},
{
"identity" : "adjust_signature_sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/adjust/adjust_signature_sdk.git",
"state" : {
"revision" : "b11c73304c2410bd410cc9369b812a83cc117002",
"version" : "3.61.0"
}
},
{
"identity" : "adyen-3ds2-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Adyen/adyen-3ds2-ios",
"state" : {
"revision" : "00862adbc079d0be943666a4ad2523deb31f9546",
"version" : "2.4.4"
}
},
{
"identity" : "adyen-authentication-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Adyen/adyen-authentication-ios",
"state" : {
"revision" : "04fe1a11b282721b5e55ef59c5417a3df41c5607",
"version" : "3.1.0"
}
},
{
"identity" : "adyen-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Adyen/adyen-ios",
"state" : {
"revision" : "3632faac5bbd30d55bf29ed8a01d4e15c85b2a7c",
"version" : "5.22.1"
}
},
{
"identity" : "adyen-networking-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Adyen/adyen-networking-ios",
"state" : {
"revision" : "43fd5d93f8587623eb134e3968f099e0417e74f6",
"version" : "3.0.1"
}
},
{
"identity" : "adyen-wechatpay-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Adyen/adyen-wechatpay-ios",
"state" : {
"revision" : "1127f793854d8624dbe6741d5c42be39dadd4f93",
"version" : "2.2.0"
}
},
{
"identity" : "alamofire",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Alamofire/Alamofire.git",
"state" : {
"revision" : "7be73f6c2b5cd90e40798b06ebd5da8f9f79cf88",
"version" : "5.11.0"
}
},
{
"identity" : "algoliasearch-client-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/algolia/algoliasearch-client-swift",
"state" : {
"revision" : "cc9a2f0c66c835d0eb851d03cf5001fb3a8fdaf5",
"version" : "9.37.2"
}
},
{
"identity" : "anyformatkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/luximetr/AnyFormatKit.git",
"state" : {
"revision" : "ae3a965164005b07f81d6aa066520d7ad14ea54e",
"version" : "2.5.2"
}
},
{
"identity" : "app-check",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/app-check.git",
"state" : {
"revision" : "61b85103a1aeed8218f17c794687781505fbbef5",
"version" : "11.2.0"
}
},
{
"identity" : "applovin-max-swift-package",
"kind" : "remoteSourceControl",
"location" : "https://github.com/AppLovin/AppLovin-MAX-Swift-Package.git",
"state" : {
"revision" : "b5acf713209298059bb2f09b22d84d523454bc7b",
"version" : "13.5.1"
}
},
{
"identity" : "auth0.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/auth0/Auth0.swift",
"state" : {
"revision" : "03c85db911c2365208497907b82b91d0a774e4e7",
"version" : "2.0.0"
}
},
{
"identity" : "braze-swift-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/braze-inc/braze-swift-sdk",
"state" : {
"revision" : "8ed872cbd122f68333928597d2b2d2af52bdceb4",
"version" : "13.3.0"
}
},
{
"identity" : "cash-app-pay-ios-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/cashapp/cash-app-pay-ios-sdk",
"state" : {
"revision" : "25f526aec9b2535d0dc4485280bbf6c7d39e3424",
"version" : "0.6.2"
}
},
{
"identity" : "chalk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/mxcl/Chalk.git",
"state" : {
"revision" : "a7f58e47a08ca5a84f73acc4bcf6c2c19d990609",
"version" : "0.5.0"
}
},
{
"identity" : "clarity-apps",
"kind" : "remoteSourceControl",
"location" : "https://github.com/microsoft/clarity-apps",
"state" : {
"revision" : "470c15abbb26a7500e992c68ef411f5e986d495d",
"version" : "3.4.2"
}
},
{
"identity" : "client-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Kameleoon/client-swift.git",
"state" : {
"revision" : "e938767a156dc562eae2b270a041be566135991a",
"version" : "4.22.2"
}
},
{
"identity" : "cwlcatchexception",
"kind" : "remoteSourceControl",
"location" : "https://github.com/mattgallagher/CwlCatchException.git",
"state" : {
"revision" : "07b2ba21d361c223e25e3c1e924288742923f08c",
"version" : "2.2.1"
}
},
{
"identity" : "cwlpreconditiontesting",
"kind" : "remoteSourceControl",
"location" : "https://github.com/mattgallagher/CwlPreconditionTesting.git",
"state" : {
"revision" : "0139c665ebb45e6a9fbdb68aabfd7c39f3fe0071",
"version" : "2.2.2"
}
},
{
"identity" : "filecheck",
"kind" : "remoteSourceControl",
"location" : "https://github.com/llvm-swift/FileCheck.git",
"state" : {
"revision" : "f7c5f1a9479b33a876a6f5632ca2b92a7ce4b667",
"version" : "0.2.6"
}
},
{
"identity" : "firebase-ios-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk.git",
"state" : {
"revision" : "45210bd1ea695779e6de016ab00fea8c0b7eb2ef",
"version" : "12.7.0"
}
},
{
"identity" : "google-ads-on-device-conversion-ios-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/googleads/google-ads-on-device-conversion-ios-sdk.git",
"state" : {
"revision" : "35b601a60fbbea2de3ea461f604deaaa4d8bbd0c",
"version" : "3.2.0"
}
},
{
"identity" : "googleappmeasurement",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : {
"revision" : "c2d59acf17a8ba7ed80a763593c67c9c7c006ad1",
"version" : "12.5.0"
}
},
{
"identity" : "googledatatransport",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleDataTransport.git",
"state" : {
"revision" : "617af071af9aa1d6a091d59a202910ac482128f9",
"version" : "10.1.0"
}
},
{
"identity" : "googleutilities",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleUtilities.git",
"state" : {
"revision" : "60da361632d0de02786f709bdc0c4df340f7613e",
"version" : "8.1.0"
}
},
{
"identity" : "grpc-binary",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/grpc-binary.git",
"state" : {
"revision" : "75b31c842f664a0f46a2e590a570e370249fd8f6",
"version" : "1.69.1"
}
},
{
"identity" : "gtm-session-fetcher",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/gtm-session-fetcher.git",
"state" : {
"revision" : "a2ab612cb980066ee56d90d60d8462992c07f24b",
"version" : "3.5.0"
}
},
{
"identity" : "interop-ios-for-google-sdks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/interop-ios-for-google-sdks.git",
"state" : {
"revision" : "040d087ac2267d2ddd4cca36c757d1c6a05fdbfe",
"version" : "101.0.0"
}
},
{
"identity" : "ios-snapshot-test-case",
"kind" : "remoteSourceControl",
"location" : "https://github.com/uber/ios-snapshot-test-case.git",
"state" : {
"revision" : "7b10770333a961be6e5a41c9ce04b8c6d3990126",
"version" : "8.0.0"
}
},
{
"identity" : "ios_sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/adjust/ios_sdk",
"state" : {
"revision" : "fbe95360df63c3c0f9a98c5f2efb39b46bd2f08d",
"version" : "5.4.6"
}
},
{
"identity" : "jwtdecode.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/auth0/JWTDecode.swift.git",
"state" : {
"revision" : "3cd207fb9e943b6168a117baa3936c823204c2dc",
"version" : "2.6.3"
}
},
{
"identity" : "leveldb",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/leveldb.git",
"state" : {
"revision" : "a0bc79961d7be727d258d33d5a6b2f1023270ba1",
"version" : "1.22.5"
}
},
{
"identity" : "lottie-spm",
"kind" : "remoteSourceControl",
"location" : "https://github.com/airbnb/lottie-spm.git",
"state" : {
"revision" : "69faaefa7721fba9e434a52c16adf4329c9084db",
"version" : "4.6.0"
}
},
{
"identity" : "nanopb",
"kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/nanopb.git",
"state" : {
"revision" : "b7e1104502eca3a213b46303391ca4d3bc8ddec1",
"version" : "2.30910.0"
}
},
{
"identity" : "nimble",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Quick/Nimble.git",
"state" : {
"revision" : "c93f16c25af5770f0d3e6af27c9634640946b068",
"version" : "9.2.1"
}
},
{
"identity" : "pathkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/kylef/PathKit.git",
"state" : {
"revision" : "3bfd2737b700b9a36565a8c94f4ad2b050a5e574",
"version" : "1.0.1"
}
},
{
"identity" : "prebid-mobile-ios",
"kind" : "remoteSourceControl",
"location" : "https://github.com/prebid/prebid-mobile-ios.git",
"state" : {
"revision" : "0b0dc9962eac145f1e8ee7c692c735cd274eaacd",
"version" : "3.2.0"
}
},
{
"identity" : "promises",
"kind" : "remoteSourceControl",
"location" : "https://github.com/google/promises.git",
"state" : {
"revision" : "540318ecedd63d883069ae7f1ed811a2df00b6ac",
"version" : "2.4.0"
}
},
{
"identity" : "quick",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Quick/Quick.git",
"state" : {
"revision" : "8cce6acd38f965f5baa3167b939f86500314022b",
"version" : "3.1.2"
}
},
{
"identity" : "sbtuitesttunnel",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Subito-it/SBTUITestTunnel",
"state" : {
"revision" : "24141a3e88175f027aeb86ea5df55d041a9cf63f",
"version" : "11.0.0"
}
},
{
"identity" : "sdwebimage",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SDWebImage/SDWebImage.git",
"state" : {
"revision" : "36e79ba485e9bb4d3cd4e3318908866dac5e7b51",
"version" : "5.21.5"
}
},
{
"identity" : "simplekeychain",
"kind" : "remoteSourceControl",
"location" : "https://github.com/auth0/SimpleKeychain.git",
"state" : {
"revision" : "b355c569efcd409e252ccbb500d9fc2713b4d64d",
"version" : "0.12.5"
}
},
{
"identity" : "skeletonui",
"kind" : "remoteSourceControl",
"location" : "https://github.com/CSolanaM/SkeletonUI.git",
"state" : {
"revision" : "f025e9ba5d051374d7344efa8859df5b9399a181",
"version" : "2.0.2"
}
},
{
"identity" : "spectre",
"kind" : "remoteSourceControl",
"location" : "https://github.com/kylef/Spectre.git",
"state" : {
"revision" : "26cc5e9ae0947092c7139ef7ba612e34646086c7",
"version" : "0.10.1"
}
},
{
"identity" : "stencil",
"kind" : "remoteSourceControl",
"location" : "https://github.com/stencilproject/Stencil",
"state" : {
"revision" : "4f222ac85d673f35df29962fc4c36ccfdaf9da5b",
"version" : "0.15.1"
}
},
{
"identity" : "surveymonkey-ios-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SurveyMonkey/surveymonkey-ios-sdk.git",
"state" : {
"revision" : "23252ff304950bc3b78cb6c0d91e15cda6cc7a93",
"version" : "2.1.3"
}
},
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser",
"state" : {
"revision" : "c5d11a805e765f52ba34ec7284bd4fcd6ba68615",
"version" : "1.7.0"
}
},
{
"identity" : "swift-asn1",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-asn1.git",
"state" : {
"revision" : "810496cf121e525d660cd0ea89a758740476b85f",
"version" : "1.5.1"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "7b847a3b7008b2dc2f47ca3110d8c782fb2e5c7e",
"version" : "1.3.0"
}
},
{
"identity" : "swift-custom-dump",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump",
"state" : {
"revision" : "82645ec760917961cfa08c9c0c7104a57a0fa4b1",
"version" : "1.3.3"
}
},
{
"identity" : "swift-package-manager-google-mobile-ads",
"kind" : "remoteSourceControl",
"location" : "https://github.com/googleads/swift-package-manager-google-mobile-ads.git",
"state" : {
"revision" : "32c61bd35c10517bb9d1d28252af71fe7fd3d0c8",
"version" : "12.13.0"
}
},
{
"identity" : "swift-package-manager-google-user-messaging-platform",
"kind" : "remoteSourceControl",
"location" : "https://github.com/googleads/swift-package-manager-google-user-messaging-platform.git",
"state" : {
"revision" : "13b248eaa73b7826f0efb1bcf455e251d65ecb1b",
"version" : "3.1.0"
}
},
{
"identity" : "swift-protobuf",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-protobuf.git",
"state" : {
"revision" : "c169a5744230951031770e27e475ff6eefe51f9d",
"version" : "1.33.3"
}
},
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing",
"state" : {
"revision" : "a8b7c5e0ed33d8ab8887d1654d9b59f2cbad529b",
"version" : "1.18.7"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-syntax",
"state" : {
"revision" : "4799286537280063c85a32f09884cfbca301b1a1",
"version" : "602.0.0"
}
},
{
"identity" : "swiftcheck",
"kind" : "remoteSourceControl",
"location" : "https://github.com/typelift/SwiftCheck.git",
"state" : {
"revision" : "077c096c3ddfc38db223ac8e525ad16ffb987138",
"version" : "0.12.0"
}
},
{
"identity" : "swiftgenplugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SwiftGen/SwiftGenPlugin.git",
"state" : {
"revision" : "879b85a470cacd70c19e22eb7e11a3aed66f4068",
"version" : "6.6.2"
}
},
{
"identity" : "then",
"kind" : "remoteSourceControl",
"location" : "https://github.com/devxoul/Then.git",
"state" : {
"revision" : "d41ef523faef0f911369f79c0b96815d9dbb6d7a",
"version" : "3.0.0"
}
},
{
"identity" : "uickeychainstore",
"kind" : "remoteSourceControl",
"location" : "https://github.com/kishikawakatsumi/UICKeyChainStore",
"state" : {
"revision" : "8220ac38124613fb709508426f75fbac6921e261",
"version" : "2.2.1"
}
},
{
"identity" : "uid2-ios-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/IABTechLab/uid2-ios-sdk.git",
"state" : {
"revision" : "f6f4ee78a03b5cd08f24a31444ff8b7ea06be476",
"version" : "2.0.0"
}
},
{
"identity" : "vcrurlsession",
"kind" : "remoteSourceControl",
"location" : "https://github.com/plu/VCRURLSession",
"state" : {
"revision" : "719d9796238dd6c431dbb29f2107ec5b5e668b3d",
"version" : "2.0.2"
}
},
{
"identity" : "xctest-dynamic-overlay",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "34e463e98ab8541c604af706c99bed7160f5ec70",
"version" : "1.8.1"
}
},
{
"identity" : "zeotapcollect",
"kind" : "remoteSourceControl",
"location" : "https://github.com/zeotap/ZeotapCollect",
"state" : {
"revision" : "3d5d4eb89db67d92b49be3dc64deab513c90e0d0",
"version" : "1.3.10"
}
}
],
"version" : 2
}

```

### If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet

```yml

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

```

Contributor guide

Open the contributing guide

Research direction

Start by reading RCNConfigRealtime's retryHTTPConnection method and its _isInBackground state handling. The issue provides no reproduction steps or test file, so inspect the Remote Config realtime connection flow and existing background-transition coverage. Done means the reported background connection attempts and resulting FIRRemoteConfigUpdateErrorStreamError events are addressed, with regression coverage if the behavior can be reproduced.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, objective-c
Domain
mobile-dev, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.