I have a late 2011 Macbook pro, and lately it hasn't been sleeping properly. If I close the lid for less than a minute and reopen it, it doesn't go to sleep while the lid is closed. The screen is still displayed immediately after reopening. Also, a few seconds after I open the machine, it will go to sleep on it's own. I have had the software checked and that doesn't seem to be the problem. What could be causing this and how do I get it fixed? It is still under warranty.
If there is a process that is preventing sleep (rather than a bug in the sleep implementation), you can use "pmset -g" in a terminal window to list the process that is doing that. This is covered over on superuser.
Here is an an example on my system. First, with nothing preventing sleep:
Then I start music in iTunes:
Your problem same me. After this, i reinstall Mac because i can't debug my error.
However, you can try:
_If your Mac has got uTorrent and still running it, please EXIT it.
_If your Mac has got Dropbox, uncheck "Enable LAN sync"
How long does it take to get to sleep on its own if you leave it?
I'd suggest looking at the log entries in the Console.app to see what's happening when it tries to go to sleep.
A few things that I've encountered that can make a Mac slow to sleep:
Aside from looking at the console for hints and checking your free disk space, this is the sort of thing where doing an SMC reset might actually be applicable.