Mac wakes up from sleep every night and then goes back to sleep immediately

I've had my Mac Mini for about six months now. Every night, I put it to Sleep rather than shutting it down. Since about two weeks ago, the Mac Mini wakes up from sleep around 1 to 3 am, once a night, and then after about 10 seconds, it puts itself back to sleep. Why does it do this? Is it performing some sort of maintenance function? But that then begs the question, why is it only doing this recently, and not a few months ago?

I checked the Console for messages, and there's roughly the same thing every night. Here's part of what appears in the logs, particularly whatever pertains to waking from sleep (let me know if you need me to post a specific snippet):

Sep 14 02:00:30 gary-mac kernel[0]: AppleThunderboltNHIType2::waitForOk2Go2Sx - retries = 6
Sep 14 02:00:30 gary-mac kernel[0]: IOThunderboltSwitch<0xffffff8048e40000>(0x0)::listenerCallback - Thunderbolt HPD packet for route = 0x0 port = 12 unplug = 0
Sep 14 02:00:30 gary-mac kernel[0]: TBT W (2): 0x0100 [x]
Sep 14 02:00:30 gary-mac kernel[0]: Wake reason: EC.SleepTimer (SleepTimer)
Sep 14 02:00:30 gary-mac kernel[0]: AirPort_Brcm43xx::powerChange: System Wake - Full Wake/ Dark Wake / Maintenance wake
Sep 14 02:00:30 gary-mac kernel[0]: Previous Sleep Cause: 5
Sep 14 02:00:30 gary-mac kernel[0]: The USB device USB 3.0 HUB
Sep 14 02:00:30 gary-mac kernel[0]: (Port 1 of Hub at 0x15000000) may have caused a wake by issuing a remote wakeup (1)

I'm sure there's something useful in there (such as references to the USB ports) but I can't exactly figure them out. For your information, my Mac Mini has four USB ports, and all four are used. USB port 1 is an external drive, USB port 2 is an external drive, USB port 3 is connected to a KVM, which provides access to my mouse and keyboard, and USB port 4 is connected to a USB 3 hub that splits the port into four other ports.

When I go to the System Information app to determine what device is at USB location 0x15000000, I get the following:

USB 3.0 HUB:

Product ID: 0x0812
Vendor ID:  0x2109  (VIA Labs, Inc.)
Version:    85.71
Speed:  Up to 5 Gb/sec
Manufacturer:   VLI Labs, Inc. 
Location ID:    0x15100000 / 3
Current Available (mA): 900
Current Required (mA):  0

It just looks like a generic device of some sort. Right above this device in the System Information app is the first USB device I have connected, which is my external drive for Time Machine. Could that be the problem somehow, even though its device location is 0x15400000 / 4?

Could this problem be due to the recently released Mac OS X 10.8.5? It seems like the problem started occurring a few days after the update was released. I have already performed the basic maintenance of resetting the SMC and PRAM, and Repairing Disk Permissions, but that didn't fix the problem. Also, in the System Preferences -> Energy Saver page, I've got all checkboxes UNchecked (including "Wake for network access"). I haven't had any other wake issues since this started happening. Plus, the fact that the Mac Mini goes back to sleep after a few seconds doesn't seem to indicate that it could possibly be a network access problem, or a mouse randomly moving, right?


Solution 1:

I'd eliminate any external devices as the cause of waking first. You can set the MacMini to go to sleep automatically, then eject/unplug all external devices. KVM & Mice are the usual suspects...

(Port 1 of Hub at 0x15000000) may have caused a wake by issuing a remote wakeup (1)

If you haven't already, you may be able to identify the USB device suspected of issuing the remote WakeUp call.

About this Mac > System Report > Hardware > USB > USB Device Tree

or use the shell command system_profiler SPUSBDataType

Solution 2:

This issue reminds me of the behaviour of Wake on Demand and Bonjour Sleep Proxy. See Apple HT3774, which includes:

... your Mac will occasionally wake for a brief time, without lighting the screen, in order to maintain active shared service registrations with the Bonjour Sleep Proxy. On some Macs, sounds from the optical drive, hard drive, or fans may be heard during these brief periods.

However... you do say that "Wake for network access" is unchecked, so I think the behaviour you are seeing is not expected.

I would try turning off WiFi before putting your Mac mini to sleep, and see if that stops it waking up. (That probably isn't a great solution, but it might be the first step in finding one...)

Solution 3:

I hadn't actually gotten around to doing any testing on this problem yet. However, I updated my Mac to 10.8.5 with the OS X v10.8.5 Supplemental Update released yesterday (or a few days ago), and the problem stopped occurring this morning. Of course, I'll wait a week to determine if it's really fixed or not, but it looks like this update fixed the problem. Which would indicate that it was a bug in OS X all along.

In particular, it looks like Fixes an issue that may cause external drives to be ejected after the computer goes to sleep was the problem.