MacOS – After midnight insomnia

google-chromemacossleep-wake

MacBook Air 2012 with Sierra 10.12.6

Something is draining my battery overnight.

The pmset -g assertions
Assertion status system-wide:

BackgroundTask                 0
   ApplePushServiceTask           0
   UserIsActive                   1
   PreventUserIdleDisplaySleep    0
   PreventSystemSleep             0
   ExternalMedia                  0
   PreventUserIdleSystemSleep     0
   NetworkClientActive            0
Listed by owning process:
   pid 117(hidd): [0x00052d7300099bbd] 02:56:54 UserIsActive named: "com.apple.iohideventsystem.queue.tickle.4294976712.3" 
    Timeout will fire in 1440 secs Action=TimeoutActionRelease
No kernel assertions.
Idle sleep preventers: IODisplayWrangler

Turned off WiFi and anything that would wake it up or keep awake, problem remains. Battery is down to 5-10% in 8 hours of sleep time.
Battery is new (6 months old)

Charge Information:
  Charge Remaining (mAh):   7334
  Fully Charged:    Yes
  Charging: No
  Full Charge Capacity (mAh):   7340
  Health Information:
  Cycle Count:  15
  Condition:    Normal
  Battery Installed:    Yes

Following was active at lid closing time:
Mail, Skype, Chrome (with 10 tabs)

Found a suggestion to address the:

 Idle sleep preventers: IODisplayWrangler

by removing/resetting Printers and other stuff
https://discussions.apple.com/thread/7275550?start=0&tstart=0
No help.

Update:
Running log show --style syslog | fgrep "Wake reason"
shows noting in the hours of interest!

Manual method: Review Console system log …
Found huge activity from Google Chrome reporting errors

Aug 16 01:22:29 myMBA Google Chrome[18176]: objc[18176]: __weak variable at 0x600001228a50 holds 0x2121212121212121 instead of 0x600000c279a0. This is probably incorrect use of objc_storeWeak() and objc_loadWeak(). Break on objc_weak_error to debug.

and Google Software trying to do update on repeated basis?

Aug 16 01:40:11 myMBA GoogleSoftwareUpdateAgent
Closed Chrome overnight, still the same.

More investigation (and it repeats following every 30 second all night long):

pmset -g log

UUID: C67362CF-C70A-4AC3-AB1E-EC803FD0563F
2017-08-18 04:53:46 -0700 Notification          Display is turned off                                                                 
2017-08-18 04:53:46 -0700 Assertions            PID 117(hidd) Summary UserIsActive "com.apple.iohideventsystem.queue.tickle.4294968070.3" 07:57:39  id:0x0x90000926c [System: DeclUser kDisp]          
2017-08-18 04:53:46 -0700 Assertions            PID 50(UserEventAgent) Summary BackgroundTask "com.apple.mds.3" 36:06:15  id:0x0xb00008082 [System: DeclUser kDisp]          
2017-08-18 04:53:46 -0700 Assertions            Kernel Idle sleep preventers: -None-          
2017-08-18 04:53:46 -0700 Assertions            PID 62(powerd) Created InternalPreventSleep "com.apple.powermanagement.darkwakelinger" 00:00:00  id:0x0xd0000937e [System: PrevIdle DeclUser SRPrevSleep kCPU kDisp]          
2017-08-18 04:53:47 -0700 Assertions            Kernel Idle sleep preventers: IODisplayWrangler          
2017-08-18 04:53:47 -0700 Notification          Display is turned on                                                                  
2017-08-18 04:53:49 -0700 Kernel Client Acks    Delays to Sleep notifications: [AppleBacklightDisplay driver is slow(msg: SetState to 0)(984 ms)] [AppleIntelFramebuffer driver is slow(msg: SetState to 1)(420 ms)] [AppleHDADriver driver is slow(msg: SetState to 1)(409 ms)] [AppleHDADriver driver is slow(msg: SetState to 1)(441 ms)] [AppleIntelFramebuffer driver is slow(msg: SetState to 2)(1027 ms)]           
2017-08-18 04:54:01 -0700 Assertions            PID 62(powerd) TimedOut InternalPreventSleep "com.apple.powermanagement.darkwakelinger" 00:00:15  id:0x0xd0000937e [System: DeclUser SRPrevSleep kCPU kDisp]          
Sleep/Wakes since boot at 2017-08-16 16:47:11 -0700 :0   Dark Wake Count in this sleep cycle:1

Problem remains, something is draining the battery. How can I prevent this drain from happening?

Best Answer

Finally, I got it to obey when I say sleep !

The battery remained at 100% charge after 8 hours of sleep.

This is what sleep should look like between 1AM and 10AM. That's it, no other activity as it should be.

Aug 19 01:05:19 myMBA com.apple.usbmuxd[4793]: notice    Idle, stopping.
Aug 19 01:05:19 myMBA com.apple.usbmuxd[7126]: notice    usbmuxd-374.913 on Mar 17 2017 at 17:43:50, running 64 bit
Aug 19 01:05:54 myMBA com.apple.xpc.launchd[1] (com.apple.xpc.launchd.domain.user.501): Service "com.apple.xpc.launchd.unmanaged.loginwindow.113" tried to hijack endpoint "com.apple.tsm.uiserver" from owner: com.apple.SystemUIServer.agent
Aug 19 01:06:24 --- last message repeated 3 times ---
Aug 19 02:16:35 myMBA syslogd[51]: ASL Sender Statistics
Aug 19 09:52:58 myMBA syslogd[51]: ASL Sender Statistics

So what did I do? First it killed the pesky GooleSotwareUpdate (as described here) Pesky Google acting up .. that was active all night long and completely ignoring my sleep request. Then I shut down all apps (especially the Google Chrome that was misbehaving). Then I Left the Lid open and used the Sleep now command (in Apple top left) The reason for Lid open was to see if monitor comes on after a while, and it did ! I had to use the Sleep command 3 times, since it came back on about 3 seconds after ?