Having problems connecting to sites with browsers like Firefox and Chrome? Do pages seem to hang with a “Performing TLS Handshake” message at the bottom? Is it particularly bad if you try to open multiple tabs all at once? Here’s one reason why that happens, and how to fix it.
I do most of my web surfing from a desktop computer, and I’ve been seeing this error message a fair bit lately:
(That’s from Firefox. Other browsers like Chrome report connection errors in similar ways.)
I tried the usual things (e.g. clearing caches, restarting the browser, tracing routes to the site I was trying to connect to, rebooting the computer, cycling the router, checking my ISP’s status page for outages, seeking enlightenment from the Duck) but none of that helped.
The connection failures seemed random. They would crop up now and then, with no apparent pattern. They weren’t isolated to any particular sites. When I was just surfing the web normally it would happen every-so-often — maybe a few times a night. Just enough to be annoying, but not enough to give me a clear clue as to their cause.
What I did notice is that it happened more frequently when I opened multiple tabs at once. I have over 20 news sites in a single bookmark folder, and CTRL-clicking the folder opens all the tabs at the same time. It was pretty-much certain that at least one site would fail to load properly when I did that.
Even if a site failed to load, pressing F5 (a simple reload) would always load it successfully on the second attempt. Weird.
Further, I use KVM on Ubuntu to develop software in virtual machines, and I noticed odd network behaviour in there as well. Behaviour that, well, just seemed out of place. Linux servers tend to be rock solid, and their networking tends to be rock solid. You get used to the reliability and performance. So when the networking starts misbehaving — even a little — you tend to notice.
Scanning /var/log/syslog
I noticed an unusually high frequency of the following types of message:
systemd-resolved : Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP. kernel : enp37s0 NIC Link is Down
A DNS lookup failing immediately followed by the network card being reported as down (and subsequently brought back up). WTF? Why is my Ethernet connection going down?
I tried the usual things (e.g. check and reconfigure NetworkManager, netplan, networkd, switch the Ethernet cable to a different port on the router, try a different cable) all to no avail.
Following the process of elimination, I eventually ended up logged into the router — a FritzBox 7490:
Under Home Network » Network » Network Settings » LAN Settings I had the following:
Yep, exactly as I wanted it. Since my ADSL Internet connection is the bandwidth bottleneck, I prefer to leave LAN ports at 100Mbps most of the time to reduce power consumption and generate less heat. It’s only when I need to sling around huge amounts of data on the LAN that I switch the ports to 1Gbps.
Since I’d exhausted pretty-much all other options, I switched the ports from “Green Mode” to “Power Mode”, then opened up the 20 tabs in my News folder… Nothing. No connection failures. Hmmm…
I restarted the browser and tested again. No connection failures.
I rebooted the computer and tested again. No connection failures.
I surfed for days. No connection failures.
Woo-hoo!
The “Green Mode” for LAN ports on a FritzBox 7490 doesn’t just lower the connection speed to 100Mbps — it puts the Ethernet port into a low-power standby mode that effectively drops the connection at the other (computer) end within (tens of) seconds of the link going idle. TLS handshakes weren’t failing because there was something wrong with the websites I was trying to connect to — they failed because the link between my computer and the router was down!
Now, I have had consumer electronics annoy the crap out of me in the past with their over-zealous “energy saving features”, and AVM (the manufacturer of the FritzBox) is based out of Germany, so I suspect that the root cause of this might be some sort of poorly-conceived EU Directive mandating extremely low power consumption modes. Regardless, the workaround ended up being trivial, rock-solid networking has been restored, and there are no more connection failures when web surfing — so I’m back to being a happy camper. 🙂
TL;DR: If you are experiencing web connection errors, and your computer/laptop is connected via Ethernet to your router, check the settings on your router for any “energy saving features” that might possibly be causing your ports to go into “standby mode”. If you are connecting via Wi-Fi then a “low power” transmitter setting might cause similar sorts of issues, and cranking up the power may help solve them.
I hope that ends up being useful to someone. Take it easy.