Mac Pro network drops

As I already mentioned, the Mac Pro 2008 (10.10.5) I’m running the Retrospect server on, dropped its network connection for the first time in nine years (that I’m aware of) after installing Retrospect. Since then, it’s happened more than ten times, three times just during the last 24 hours.

It certainly seems as if Retrospect has something to do with it, but on the other hand, it puts a lot of load on the network that exceeds what I normally would expose it to, so it doesn’t have to be something wrong with Retrospect itself. Also, you’ll find a lot of reports on the net about Macs of all kinds losing network connections like this, without any mention of Retrospect. So I don’t know. The worst part is that it’s not at all certain that replacing the Mac Pro with a new machine would solve it. Or updating beyond OSX 10.10 either (which I can’t do anyway; 10.10 is the last supported version of OSX on the 2008 Mac Pro).

(Update 2017-09-18: it clearly has nothing to do with Retrospect directly. I turned off the Retrospect engine and the “Instant Scan”, started copying a massive amount of data from the Mac Pro to the Synology using Finder, and I got network drops every ten minutes or so. Heavy network traffic is enough to trigger it. Switching to the other interface didn’t help either.)

I did, however, pick up a script someone has written which toggles the network to fix the problem when it occurs. I took that script and simplified it greatly. I’ve lost the link to the original. Sorry about that.

The original script was meant to test connectivity by pinging every 90 seconds, then took about 10-20 seconds to verify that the network was down before toggling the interface. This meant up to two minutes of downtime; long enough to interrupt backups or long-running network processes like copy or move of entire directories. I slimmed down the script and made it react and restore the network connection in less than 10 seconds, which seems short enough to preserve open network connections.

#!/bin/bash
# check for lack of ping, restarts the en0 if necessary

while [ 1 ] 
do
  IS=`/sbin/ping -c 5 10.55.66.1 | grep -c "64 bytes"`
  if (test "$IS" -gt "2") then
    echo "Your internet connection appears to be working. Code" $IS
  else
    echo "There is a problem with your internet connection. Attempting to fix by ethernet restart... "
    ifconfig en0 down
    sleep 5
    ifconfig en0 up
    sleep 5
    sendemail -f scripts@example.com -t martin@example.com -u "Internet Connection Down on $(date '+%Y-%m-%d @ %H:%M:%S')" -m "Connection restarted" -s smtp.example.com:587 -xu scripts@example.com -xp <password>
  fi
done

The network interface should be the one you’re using, of course. On the Mac Pro, it’s en0 or en1.

Note that the IP you ping in the script should be on your local net, preferably the upstream gateway. If you reach out to the Internet, there’s a risk you’ll trigger the toggle far too easily.

To send out an email you need to get the sendemail utility. Easiest is through homebrew:

brew update
brew install sendemail

You start this script through launchctl, but I’m taking the easy way out by using Lingon to set it up to run “always” as root, which means that if it for some reason exits, it will automatically restart. It must be run as root to be able to toggle the interface.

When run that way, the two “echo” statements do nothing you can see, of course, but they’re useful when debugging through the command line.

Since running this script, I’ve had a number of network outages, but none that interrupted ongoing backups or other network processes. It’s quick enough to fix the network on time.

2 thoughts on “Mac Pro network drops”

  1. I’ve had this problem on my Mac Pro 2008 for several years. I’ve “resolved” it by manually turning Ethernet off and back on when the probem occurs. It does happen on most days, especially when the traffic is high.

    I’ve heard this same problem on many machines, all of which are this same model. It happens on both Ethernet ports at the same time. I’d suspect a software issue.

    I’ll try your script to automate this process. It’s quite annoying as I need to open a VNC connection remotely. To make sure I can do that, I first try to the local Ethernet address. If it doesn’t answer, it means the problem has occurred. Then I try the local WiFi address, and by using that I log in and turn Ethernet off and back on again.

    1. As long as I had the Mac Pro on a local net which was bridged over WiFi to the rest of the net, this happened several times a day. A number of months ago, I replaced the WiFi bridge with a fiber optic, and now it happens once or twice a month. In other words, I think it happens when the network is too slow for the machine while carrying heavy traffic. It simply must be a bug in the network stack on OSX.

      Throughout the period since I wrote this post, the network must have gone down a hundred or more times, but not once did the script fail to restart the network. In other words, it has become a non-issue for me.

Leave a Reply to martin Cancel reply

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