How to stop the MacBook Pro from randomly freezing when trying to go to sleep

displayhangsleep-wake

My 2011 MacBook Pro has been having a problem occasionally where I put it to sleep, but it continues to run. Later when I go use it again, I realize that it was on the whole time (usually inside my bag), and by this point it is blazing hot and the fan is running at full power. It is unresponsive at this point, and I have to hold the power button to restart it. This happens I'd guess every few weeks on average, sometimes more often, sometimes less.

I often bounce between an office and home where at both locations, I use an external monitor, keyboard and mouse. This freezing seems to happen only when I'm leaving one of these two locations, in which case I follow the following procedure:

  1. Move mouse to HotCorner to put monitor to sleep (I do this instead of closing the lid since Lion has lid closing assume the external is taking over as primary display.)
  2. Close lid to put computer to sleep
  3. Disconnect cables (power, display port, usb; maybe ethernet and audio depending on location).

Lately, I've been suspecting that the above actions somehow conflict, so I've been trying to wait a few seconds between each step. I think this was helping, but today I forgot about this plan (i.e. less than 1/2 second between actions), and the crash returned.

I first contacted Apple in February, and they had me boot into safe-mode to reset something, then reset the PRAM. This didn't help, as the freezes returned. After today's crash, I called Apple again, and they recommended I try reinstalling Lion (running 10.7.3), and if that doesn't help, then go to Apple store for hardware tests.

I will give this a try, but before I do, I wanted to see if anyone has a better idea on how to prevent this from happening.

For now, I've also removed my HotCorner, and will simply use the menu or keyboard to trigger system sleep before closing my lid (i.e. to make sure that the monitor-sleep and system-sleep commands are not conflicting).

Update: I reworded some of above to try to entice solutions. Additionally, I should note that at my office, the USB is used for keyboard and mouse vs. at home, USB Is used for keyboard, mouse and external drive. The display port in both cases is connected to a DVI adapter.

Best Answer

I would try adjusting your procedure. Since as noted the quoted steps provided below in practice are causing you to unintentionally wake the Mac from sleep in step 3, which may also problematically be waking it from sleep before it finishes going to sleep in the first place. So in a sense you were telling your MacBook Air to go to sleep and while your at it wake up from sleep, remove a display and all this other stuff at the same time. That may be the cause of the freezing, the shock of all the external devices getting removed while in sleep or while the mac is going to sleep.

  1. Move mouse to HotCorner to put monitor to sleep (I do this instead of closing the lid since Lion has lid closing assume the external is taking over as primary display)
  2. Close lid to put computer to sleep
  3. Disconnect cables (power, display port, usb; maybe ethernet and audio depending on location).

USB activity as noted in Mac OS X: Why your Mac might not sleep or stay in sleep mode is a perfect way to wake your mac from sleep.

I would recommend doing the following instead:

  1. Save your important files and data in open applications in case things go wrong.
  2. Disconnect cables (power, display port, usb; maybe ethernet and audio depending on location).
  3. Wait for you mac to recognize that the external display is disconnected, usually screen fades to blue for a few seconds, before going back to normal view of your Mac. etc.

  4. Close lid to put computer to sleep or choose Apple > Sleep, etc...

  5. Verify the sleep indicator light is slowly pulsing, before placing the MacBook into any case.

So ya try this out and see if it stops the random freezing. If it does not then there may be other hardware / software problems at hand, check your system logs, etc.