Apps can't reliably use wifi

Sgtnoodle

New member
Jul 20, 2019
4
0
0
Visit site
This problem has been driving me crazy. I am an embedded software engineer and I am familiar with the gritty details of IP based networking. I am not familiar with the inner workings of Android, though. I would appreciate any specific suggestions on how to root cause this issue via adb.

Wifi connects just fine with a very strong signal. My phone has an IP address, and initially I can load up websites through chrome and opera. After a few minutes, though, web sites stop loading. The web browser seems to initiate a connection, but then it seems to stall out loading forever. This happens in both chrome and opera. Other apps like slack report "connecting..." indefinitely. This persists until I turn off wifi. If I turn on wifi again, it will work for a few minutes and then crap out again. If I reboot the phone, it seems to work a bit longer than a few minutes, but still eventually craps out. At no point does the OS complain about wifi lacking an internet connection.

If I open a shell with adb, I can reliably ping remote servers. I've examined the routing tables on my phone, and they look fine. I've collected packets on my router using tcpdump, and I can see the initial TCP connection packets and their response at least. Interestingly, if I listen for connections on port 80 using socat on my desktop and connect to it through my phone's browser, I can get text to show up in the browser. It seems that ICMP packets and very short TCP connections generally work at least.

It's not a signal strength issue, it's not a DHCP issue, it's not a route tables issue, it's not a DNS issue. It just doesn't work! Any ideas?
 

mustang7757

Super Moderator
Moderator
Feb 6, 2017
91,536
6,115
113
Visit site
This problem has been driving me crazy. I am an embedded software engineer and I am familiar with the gritty details of IP based networking. I am not familiar with the inner workings of Android, though. I would appreciate any specific suggestions on how to root cause this issue via adb.

Wifi connects just fine with a very strong signal. My phone has an IP address, and initially I can load up websites through chrome and opera. After a few minutes, though, web sites stop loading. The web browser seems to initiate a connection, but then it seems to stall out loading forever. This happens in both chrome and opera. Other apps like slack report "connecting..." indefinitely. This persists until I turn off wifi. If I turn on wifi again, it will work for a few minutes and then crap out again. If I reboot the phone, it seems to work a bit longer than a few minutes, but still eventually craps out. At no point does the OS complain about wifi lacking an internet connection.

If I open a shell with adb, I can reliably ping remote servers. I've examined the routing tables on my phone, and they look fine. I've collected packets on my router using tcpdump, and I can see the initial TCP connection packets and their response at least. Interestingly, if I listen for connections on port 80 using socat on my desktop and connect to it through my phone's browser, I can get text to show up in the browser. It seems that ICMP packets and very short TCP connections generally work at least.

It's not a signal strength issue, it's not a DHCP issue, it's not a route tables issue, it's not a DNS issue. It just doesn't work! Any ideas?
Hi, what phone your using ?
 

Sgtnoodle

New member
Jul 20, 2019
4
0
0
Visit site
I have an unlimited data plan and generally get LTE everywhere, so I usually leave it turned off unless I'm at home. When I am at home, I want my phone to be on my LAN to access chromecasts, webcams and stuff.

I have two access points at home, one of them connected to the other through WDS on 5Ghz. Today I tried giving the two access points different SSIDs on 2.4Ghz so that I could explicitly choose between them on my phone. What I noticed is that, if network connections are working while I'm connected to AP 1 and then I switch to AP 2, network connections don't work for at least a minute. Even if I disable wifi and turn it back on, my phone quickly gets an IP address again but network connections still don't work most of the time. One interesting thing I've noticed is that, if I disable wifi and then explicitly load a website over LTE, and then turn wifi back on, network connections work right away.

It's acting a lot like I'd expect if some ARP tables were getting messed up somewhere, but the fact that DHCP seems to reliably work indicates that's not the case. Also, disabling and re-enabling wifi should cause the phone to emit plenty of gratuitous ARP packets.

I'm wondering if network connections inside apps in Android generally go through some intermediate library, like google play services or whatever, and that intermediate thing is being a buggy piece of crap.

The very last message on this reddit post sounds pretty familiar... https://www.reddit.com/r/GooglePixel/comments/6xwu9t/wifi_roaming_broken_on_80/
 

Sgtnoodle

New member
Jul 20, 2019
4
0
0
Visit site
Well, this morning I moved around my two access points. My 5Ghz WDS backhaul gained a couple dB of RSSI, and my phone's wifi was generally better behaved. I'm guessing that the root cause isn't a problem on the phone, but rather due to the 5Ghz backhaul being marginal. Maybe it's time I brave an adventure into the catacombs to run some cat5e...

Now I just wish my phone would more aggressively switch between access points. When I walk from one end of the house to the other, it stays associated with the far away AP for several minutes before eventually switching. Has anyone had any luck with any wifi roaming apps?
 

mustang7757

Super Moderator
Moderator
Feb 6, 2017
91,536
6,115
113
Visit site
Well, this morning I moved around my two access points. My 5Ghz WDS backhaul gained a couple dB of RSSI, and my phone's wifi was generally better behaved. I'm guessing that the root cause isn't a problem on the phone, but rather due to the 5Ghz backhaul being marginal. Maybe it's time I brave an adventure into the catacombs to run some cat5e...

Now I just wish my phone would more aggressively switch between access points. When I walk from one end of the house to the other, it stays associated with the far away AP for several minutes before eventually switching. Has anyone had any luck with any wifi roaming apps?
Since it's a older phone it might play better on 2.4Ghz can try that also