Web browsers randomly stop talking to the Internet on MacOS…

This is a weird and utterly frustrating problem.

It’s an issue that I have seen on two totally different iMacs which I’ve owned with completely different versions of MacOS (Catalina and Big Sur).

As mentioned, I have now seen it crop up twice now – the first time was on my old 2015 27″ iMac.

Research on the web revealed that the issue has been around since at least 2014 and whilst the overall result is pretty much always the same i.e time outs in all web browsers the How, What and When varies wildly between cases which means narrowing it down to root cause is a massive problem.

Anyhow at the time where I first encountered it – I persevered for a period of months and then, one day it just disappeared (I think after an O/S upgrade) and I thought little about it since. However recently it has cropped up again on my 2020 iMac with the following configuration running Big Sur.

So what are the Symptoms doctor Grogan?

I am convinced that that this particular issue is the electronic equivalent of Thrush, it’s irritating, comes and goes and you never quite know what caused it and you’re never sure if you’ve cured it.

However with that rather lovely picture that I have placed in your head – I suppose I should describe some pain which I have had to put up with for the last three weeks or so.

  • Randomly all browser access to the Internet just times out.
    Doesn’t matter if it is Safari, Chrome, Firefox or Edge all of them at the same time will just sit there until the attempted connection times out.
    Existing tabs which have established connections to website generally continue to work, however new tabs that need to establish new connections and therefore don’t work.
  • Sometimes the problem will go away within a minute or so, sometimes it will last for several minutes and on other occasions the only solution is to do a reboot the Mac.
  • Some days it doesn’t happen at all and on others it’s every 15 – 30 minutes.
  • There isn’t an obvious pattern as to what triggers it.There was a time where I thought that it happened with certain web sites (such as M365, Twitter or Instagram) – but after further analysis found that wasn’t the case.
    I also thought that websites that use either TLS or SSL had problems, but again after further analysis realised that was a dead end to as I could not connect to a local web server which doesn’t use a secure connection.
  • Applications such as Teams, Ping, NSLOOKUP work as you’d expect.

Now before I go any further and get into some of the solutions that I had read about online – I hadn’t done anything recently that one could regard as “odd” with my Mac which could have resulted in this problem.

There were a couple of patches to Big Sur (which you could argue might of been at fault – but I could find nothing on the web which suggested anything related to the new updates) and I did create a new Network Location, but I have done that several times with no consequences.

OK, so what were the possible solutions – did you use Canesten?

There was quite a lot of possible solutions which people had tried from what I read online. Some had merit whilst some others seemed a little extreme!

The following are examples of some of the more legitimate potential causes and what the authors did to try and solve the problem. I have also tried to explain what I interpret as the rationale for implementing these “fixes” as, at least on paper can seem a little out there!

Certain types of NAS storage device (Synology) being present on the network.

I have to say that not everyone experiencing the problem had any NAS storage – including me.

However that being said, upon further investigation of the NAS theory there was a reference to it being used as a backup target for Time Machine.
Now, I do use Time Machine myself to backup periodically during the day to an external 4TB drive.

I picked up on this as another poster explained that they had “solved” the problem by increasing the File Descriptor Limit within MacOS.

In MacOS (or any Unix / Linux variant) at the most simple level a File Descriptor is an entry that is created in the Kernel that represents any open file or network socket and any information associated with it.

You can run out of File Descriptors (which can have a significant impact on the Operating System or any application which is trying to open files which manifests as performance problems – or – hanging).

So there is a possible link there between how busy your system is with open files and the browsers not working. It doesn’t however explain why utilities such as “Ping” still work.

When you open a web browser in MacOS it will create File Descriptors which represent open network sockets and files that the browser is using – and example of this can be seen by opening a Terminal window and typing:

lsof -n | awk '{print $1}' | uniq -c | sort -rn | head

You will see output similar to below:

The lsof command stands for “List of Open Files” and it does what it says on the tin – it will list the open files on your Mac.
In the command that we have used above we are getting the processes by name and the number of files that they have open.

This is relevant as there are some limits set within MacOs in regard to the number of File Descriptors (that correspond to each open file or socket). You can see those default limits by typing:

launchctl limit maxfiles

Which will give you an output of the following:

Interpreting the above is important. You have two values by default – “256” which is the ‘soft limit‘ and “Unlimited” which is the ‘hard limit‘.
In truth “Unlimited” is only marginally more than the soft limit and it is not uncommon for it to be raised as particularly with developer based Macs you can run out of File Descriptors.

I know that you might be thinking “unlimited means unlimited – right?” – well yes, just not in this case. There is a complicated explanation behind all of this – and I won’t get into the whole discussion of “unlimited” actually representing a decimal value and when you change it you can’t simply put it back to “unlimited” – so I will save your brains and just say it’s some voodoo stuff in the guts of MacOS that you don’t really need to understand. You can look it up – but I needed a lay down after reading it – although it was fascinating!

Changing the maxfiles value can be done from the Terminal application – however once you reboot the settings will revert back to the defaults; however if you wish to make the changes permanent use the following method (for Big Sur):

  1. Using a text editor start a new file and copy and paste the following into it:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plistversion="1.0">
    <dict>
    <key>Label</key>
    <string>limit.maxfiles</string>
    <key>ProgramArguments</key>
    <array>
    <string>launchctl</string>
    <string>limit</string>
    <string>maxfiles</string>
    <string>65536</string>
    <string>65536</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    </dict>
    </plist>

    Save it to your desktop giving it the name limit.maxfiles.plist

    Once you have saved it to the Desktop – using Finder copy it to:

    /Library/LaunchDaemons

    You will be asked to provide your admin password.

  2. Open a Terminal session and type in:cd /Library/LaunchDaemons/

    Then type each of the following commands pressing the Enter key after each:

    sudo chown -R "root" limit.maxfiles.plist
    sudo chmod 644 limit.maxfiles.plist
    sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist

  3. Reboot your Mac – after which the new setting of maxfiles will be 65536 permanently.

On a personal levelI have not (yet) implemented this solution. I did something else which, at least for now appears to have fixed my problems (which I will detail later on).
However, if it should crop up again this will be my go to next step as in principal it does make a level of sense.

A corruption in the network profiles / locations on the Mac

Some users suggested that they “fixed” their version of the problem by either creating a new Network Location profile from the Network applet in System Preferences or by deleting the following files (if present):

com.apple.airport.preferences.plist

com.apple.network.identification.plist

NetworkInterfaces.plist

preferences.plist

Settings.plist

From:

Library/Preferences/System Configuration

Personally I have tried this solution and I have to admit that it didn’t work for me. In fact I am not totally sure that creating a new network location wasn’t the main cause in the first place.

However from the research that I did online there were quite a few people who said that it had worked for them.

Disable IPv6 on the Mac

This was my chosen solution. I will make this clear that I am still monitoring if it has actually worked.
The nature of this bug is that it can come and go as it pleases – so you can think that you have cracked it – only for it to resurface days later – however so far, so good for me.

In order to disabled IPv6 on Big Sur – open a Terminal session and type the following command and then press Enter:

networksetup -setv6off wi-fi

You can check the status of IPv6 (to ensure that it is off) by typing the following command and hitting Enter:

networksetup -getinfo wi-fi

You will then see something like the following output:

After you have turned IPv6 off it should take effect straight away – but just to make sure, you can do a Renew of the IP address from DHCP via the Network settings in System Preferences.

In conclusion … Perhaps

So, do I think that I have fixed it?

Not sure.

I can say that from my own personal experience of the issue things are definitely better and I’ve not had the same level of disruption since I turned IPv6 off. However, from what I have read and experienced this thing can hide and lure you into a false sense of security.

On thing is for certain – if I do have a re-occurrence I will be adding to this post as I am determined to help anyone who runs into this – as quite frankly it’s a bastard!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.