Description
[REQUIRED] Step 2: Describe your environment
- Android Studio version: Android Studio Ladybug | 2024.2.1 Patch 3
- Firebase Component: Remote Config
- Component version: Firebase BOM 33.7.0
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
What happened?
Firebase is ignoring config fetch timeout and throws exception too late.
How can we make the problem occur?
- Emulator with GSM network type to emulate slow connectivity.
- Initialize firebase remoteConfig client with 2 seconds timeout
- Call fetch or fetchAndActivate in a slow network device.
- Wait more than 2 seconds.
- Timeout error is sent many seconds seconds later ignoring timeout.
Relevant Code:
// Init client
val client = Firebase.remoteConfig.apply {
setConfigSettingsAsync(
remoteConfigSettings {
fetchTimeoutInSeconds = 2L
}
)
}
// And later
println("FETCH AND ACTIVATE")
client.fetchAndActivate()
.addOnFailureListener {
println("FIREBASE FETCH FAILED: $it")
}.addOnCompleteListener {
println("FIREBASE FETCH COMPLETE")
}
This code prints this in console:
2024-12-30 16:43:41.924 7318-7318 I FIREBASE FETCH AND ACTIVATE
2024-12-30 16:44:13.990 7318-7318 I FIREBASE FETCH FAILED: com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException: The client had an error while calling the backend!
2024-12-30 16:44:13.990 7318-7318 I FIREBASE FETCH COMPLETE
And debugging exception it says the cause is:
java.net.SocketTimeoutException: failed to connect to firebaseremoteconfig.googleapis.com/2a00:1450:4003:803::200a (port 443) from /fec0::45a5:b4cc:36d0:be4c (port 44980) after 2000ms
IMPORTANT! It says SocketTimeout after 2000ms so maybe there is another http client involved with no timeout configured?