Description
[REQUIRED] Step 2: Describe your environment
- Android Studio version: Android Studio Giraffe
- Firebase Component: Real Time Database
- Component version: BOM 32.7.2 (and earlier too)
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
We have a small subset of users (<1%) that are experimenting problems when reading any information from our RTDB. These users experience an infinite "loading" that never gets completed (with error or success). The interesting part of the problem is that these users experiment this 100% of the times, but only in a particular device. If they change to a different device, the information loads, so it is not a bug related to their user account but to their devices. Moreover, login out or reinstalling the app does not fix the issue, so it does not seem to be related to a wrong previous session token or similar. No matter what they do, the information coming from RTDB does not load (one user claims it works in WIFI but not in cellular, but we could not verify it), but the rest of the API calls to our services are OK, so the device is connected to Internet.
We have also checked with some of the affected users that they do not have any ad-blocker or any other kind of network interceptors, and we do not see any pattern in the affected devices (different brands, models and OS versions).
Some affected devices:
SM-G975F - Android 12
21081111RG - Android 13
Mi A3 - Android 11
22101316UG - Android 13
2107113SG - Android 13
SM-A405FN - Android 11
SM-G996B - Android 12
Xiaomi 11T - Android 13
The bug is only reproduced in Android, the iOS version loads properly.
Initially we thought it was due to the use of an old version of Firebase libraries (still including SafetyNet as internal dependency), but after upgrading to latest BOM (32.7.2) we still see the exact same issue.
Due to the nature of the bug, we could not find any way for reproducing it. It just seems to happen in some random devices.
Relevant Code:
Debugging the code with remote logs, we can see the affected devices calling this Firebase code:
handler = query.addValueEventListener(object : ValueEventListener {
override fun onDataChange(snapshot: DataSnapshot) {
dataMapper(snapshot)?.let {
value = it
}
}
override fun onCancelled(error: DatabaseError) {
errorProcessor(this@FirebaseObservable, error)
}
})
However, there seems to be no callback invoked, neither the onDataChange
nor the onCancelled
seems to be called, and therefore the app just keeps waiting "forever".
Any idea why these devices are failing? How can we solve it?
Thanks!