I'm having problems with getting my late 2009 iMac (running 10.6.4) to sleep, which it is set to do after fifteen minutes of inactivity.

Sleep works fine when manually commanded - the screen, fans and disks shut down, and the lights on USB devices, such as my hub, switch off, but getting the computer to sleep automatically with the energy saver preferences is problematic.

When left idle, the screen saver activates and the display turns off on schedule. The system doesn't actually sleep, though. After about fifteen minutes (I haven't actually timed it), I can hear the fans stop and the disks spool down, but, but connected USB devices don't show any indication of sleep (for instance, the activity lights on my hub don't turn off). After a few seconds, the fans start again and the disks spool back up - though the screen doesn't come on as it would if the mouse was knocked or a USB device was plugged in or out. This then cycles endlessly.

My hypothesis is that some program is preventing or interrupting sleep by performing some action, but I'm stumped as to what it might be. The only application normally running when the program fails to sleep is Mail, and because of the disk access, I was suspicious of Dropbox, but quitting both of them doesn't help.

Does anyone have any suggestions on how to troubleshoot this? Are there any log files that would show if a particular program had woken or prevented sleep?