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

Continued WiFi / router / ISP issues with Firebase Android SDK

Open derrickrc opened this issue 2 years ago • 11 comments

[REQUIRED] Step 2: Describe your environment

  • Firebase Component: firebase-bom-30.4.1 (latest)

[REQUIRED] Step 3: Describe the problem

This is related to the following bugs: https://github.com/firebase/firebase-android-sdk/issues/1258 https://github.com/firebase/flutterfire/discussions/5546 https://github.com/firebase/firebase-android-sdk/issues/3436 https://github.com/invertase/react-native-firebase/issues/2715

I have a production app using Realtime Database Android SDK and there are what seem to be increasing instances of users being unable to access RTDB using WiFi (probably having affected at least 20% of users).

Device has internet connectivity, but simply cannot connect to Firebase. This is affecting devices from Lollipop up through Android 10.

I have tested also with Firestore writes, and the same problem occurs - it's not isolated to RTDB.

When using a mobile hotspot, connection to Firebase is always instantaneous.

In the past, a router reset has solved it. However, sometimes the router reset didn't work, and instead we had to use a dedicated separate 2.4GHz router with DHCP disabled, plugged into their main router.

Now in recent weeks, I've found cases where even the second router workaround doesn't work and now my only possible workaround is to either fully migrate away from the Android SDK and simply hit the Firebase API using HTTP requests, or to migrate away from Firebase entirely.

Are any other users of the Android SDK facing similar issues? Are ISPs clamping down more in recent months / weeks for some reason? Is there any other workaround I'm missing?

Can the team either update the Tubesock library which this seems to be built on or can they update the Android SDK to fall back on http requests or long polling (like the JS SDK) when websockets fails?

Thank you.

derrickrc avatar Sep 09 '22 20:09 derrickrc

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Sep 09 '22 20:09 google-oss-bot

HI @derrickrc, thanks for the detailed explanation of your issue. This is an odd issue, from the looks of it, if it affects both Firestore and RTDB, and you haven't had any changes on your code(specifically changes on your Firebase SDK versions) when the issue occurred, then this definitely sounds like a backend problem. Just a thought, it might be due to a zonal failure or restricted location. But, I think it would be best if you reach out to our Firebase Support. They'll be able to assist you better, since they have visibility on your project details.

As for Tubesock library, I'll mark this issue as a feature request for now. So our engineers can take a look once they have the time. Thanks!

argzdev avatar Sep 13 '22 09:09 argzdev

HI @derrickrc,

Given the information you provided, firebase is unlikely the one having problems. RTDB and Firstore use different connecting ways so if you observe same behaviour on both products, it is possible the issue related to your internet connections.

cherylEnkidu avatar Sep 13 '22 22:09 cherylEnkidu

Thank you both. I did raise this bug with Firebase support about a year ago, and their response was the same which was to point to a network issue.

That said, if you haven't already, please read https://github.com/firebase/firebase-android-sdk/issues/1258. Many have encountered this issue and there is no resolution, and while it seems it only occurs with certain routers / networks / ISPs, it specifically affects Android + Firebase SDK (iOS is unaffected) while devices still retain internet connectivity.

So to me even if the root cause a network issue, I wonder if any update to the SDKs can be made to mitigate this issue - for example, falling back on the HTTP layer / long polling if it encounters a websocket issue / error. Thank you.

derrickrc avatar Sep 15 '22 16:09 derrickrc

Hey @derrickrc

There is a similar issue we have been working with grpc to resolve, and we might have a fix from grpc. I do not know if that will fix all of the connectivity problems, but I'll make sure to update this ticket with that fix is landed so folks can try out.

wu-hui avatar Oct 11 '22 15:10 wu-hui

One more issue related to this: https://github.com/firebase/flutterfire/discussions/5708?

iLoveDocs avatar Apr 15 '23 18:04 iLoveDocs

Hi @derrickrc,

Are you still experiencing problem? If not, I would like to close this issue.

tom-andersen avatar Apr 17 '23 18:04 tom-andersen

@tom-andersen thanks for checking in - unfortunately yes, this issue still occurs though more infrequently. Just last month we had to ship a customer a 2.4GHz WiFi access point specifically to fix this issue, as their own network / modem prevented the Android device from communicating with Firebase Realtime Database.

derrickrc avatar Apr 20 '23 20:04 derrickrc

A bit off-topic, but as an FYI, I am currently in Indonesia and cannot connect to any of my firebase projects (region doesn't seem to matter) unless I use a VPN. This is true for both Android, iOS and Firebase Hosting, so I don't think it's a problem with this SDK specifically.

Qw4z1 avatar Oct 24 '23 03:10 Qw4z1

Another seemingly related issue: https://github.com/googleapis/python-firestore/issues/787

eranl avatar Mar 22 '24 17:03 eranl

I had this issue connecting to firestore on both android and linux/python, and it seems to have been an issue with an old cable modem. It would go away temporarily on modem reboot, and seems to be gone completely with a new modem.

For reference, I never saw this issue on linux/java or windows/java, on the same network.

eranl avatar Mar 22 '24 18:03 eranl