3

Problem

My MacBook Pro seems to have trouble sleeping when closed. I noticed it because it's hot in the mornings, while the battery is nearly drained. It doesn't happen all the time, and, unfortunately, I don't know how to reproduce this behaviour on purpose.

Sometimes I use Caffeine, an app which makes sure Mac won't go to sleep. I used it with my old MacBook 12' and it worked well with Caffeine activated (it was sleeping tight). This one though, I can't leave it in my backpack on (alleged) sleep since I'm afraid of damaging it from excessive heat. However this app seems to be unrelated to be problem, since it occurred without the application as well.

Question

What wakes my Mac and how can I be sure that it'll sleep for the whole night?

Additional information

MacBook Pro (13-inch, 2018, Four Thunderbolt 3 Ports), Mojave 10.14.4, 2,3 GHz Intel Core i5, 16 GB 2133 MHz LPDDR3

I did some research, tried to investigate it on my own, but I'm clueless with this output:

$ log show --style syslog # excerpt - the first line is repeated many times during the night
2019-05-21 00:18:57.630795+0200  localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.630796+0200  localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.630797+0200  localhost apsd[74]: <private>: Not choosing red list for topic com.apple.Notes because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.630798+0200  localhost apsd[74]: <private>: Not choosing red list for topic com.apple.Notes because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.630799+0200  localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.630799+0200  localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.630800+0200  localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.630801+0200  localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.630965+0200  localhost apsd[74]: (Security) Created Activity ID: 0xe3c85, Description: SecItemCopyMatching
2019-05-21 00:18:57.631108+0200  localhost apsd[74]: (Security) Created Activity ID: 0xe3c86, Description: SecItemCopyMatching
2019-05-21 00:18:57.631112+0200  localhost apsd[74]: (Security) Created Activity ID: 0xe3c87, Parent ID: 0x80000000000e3c86, Description: SecItemCopyMatching_ios
2019-05-21 00:18:57.631166+0200  localhost apsd[74]: (Security) [com.apple.securityd:SecCritical] Failed to talk to secd after 4 attempts.
2019-05-21 00:18:57.631190+0200  localhost apsd[74]: (Security) Created Activity ID: 0xe3c88, Description: SecItemCopyMatching
2019-05-21 00:18:57.631292+0200  localhost apsd[74]: Looking up connection on peer: 5ab15c70   found <private>
2019-05-21 00:18:57.631495+0200  localhost apsd[74]: successful entitlement check 'com.apple.private.push-to-wake' for 263
2019-05-21 00:18:57.631508+0200  localhost apsd[74]: [com.apple.apsd:connectionServer] <private>: connection set push wake topics from <private> to <private>
2019-05-21 00:18:57.631586+0200  localhost apsd[74]: <private>: Filter will potentially be changed by <private>
2019-05-21 00:18:57.631595+0200  localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631596+0200  localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631598+0200  localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631599+0200  localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631600+0200  localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631601+0200  localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631603+0200  localhost apsd[74]: <private>: Not choosing red list for topic com.apple.private.ids because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631604+0200  localhost apsd[74]: <private>: Not choosing red list for topic com.apple.private.ids because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631606+0200  localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631606+0200  localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631608+0200  localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
...
$ pmset -g assertions
Assertion status system-wide:
   BackgroundTask                 0
   ApplePushServiceTask           0
   UserIsActive                   1
   PreventUserIdleDisplaySleep    0
   PreventSystemSleep             0
   ExternalMedia                  0
   PreventUserIdleSystemSleep     1
   NetworkClientActive            0
Listed by owning process:
   pid 286(sharingd): [0x000142480001a7f2] 00:00:38 PreventUserIdleSystemSleep named: "Handoff"
   pid 97(hidd): [0x000135310009a2c8] 00:00:00 UserIsActive named: "com.apple.iohideventsystem.queue.tickle.4295051175.3"
    Timeout will fire in 600 secs Action=TimeoutActionRelease
Kernel Assertions: 0x104=USB,MAGICWAKE
   id=508  level=255 0x100=MAGICWAKE mod=21/05/2019, 15:48 description=en0 owner=en0
   id=1165  level=255 0x4=USB mod=01/01/1970, 01:00 description=com.apple.usb.externaldevice.01100000 owner=USB3.0 Hub
   id=1167  level=255 0x4=USB mod=01/01/1970, 01:00 description=com.apple.usb.externaldevice.14200000 owner=USB2.0 Hub
Idle sleep preventers: IODisplayWrangler
$ pmset -g
System-wide power settings:
Currently in use:
 standbydelaylow      10800
 standby              1
 womp                 1
 halfdim              1
 hibernatefile        /var/vm/sleepimage
 proximitywake        1
 powernap             1
 gpuswitch            2
 networkoversleep     0
 disksleep            10
 standbydelayhigh     86400
 sleep                1
 hibernatemode        3
 ttyskeepawake        1
 displaysleep         10
 tcpkeepalive         1
 highstandbythreshold 50
 acwake               0
 lidwake              1

Update

The problem occurred once again, so here are some fresh logs.

pmset -g assertions                                                                              SIG(127) ↵  676  08:22:09
2019-05-31 08:22:11 +0200
Assertion status system-wide:
   BackgroundTask                 0
   ApplePushServiceTask           0
   UserIsActive                   1
   PreventUserIdleDisplaySleep    0
   PreventSystemSleep             0
   ExternalMedia                  0
   PreventUserIdleSystemSleep     1
   NetworkClientActive            0
Listed by owning process:
   pid 339(sharingd): [0x0000f2370001927c] 00:04:15 PreventUserIdleSystemSleep named: "Handoff"
   pid 97(hidd): [0x0000f1db00099242] 00:00:00 UserIsActive named: "com.apple.iohideventsystem.queue.tickle.4295045456.3"
    Timeout will fire in 120 secs Action=TimeoutActionRelease
No kernel assertions.
Idle sleep preventers: IODisplayWrangler
pmset -g                                                                                                  ✔  677  08:22:11
System-wide power settings:
Currently in use:
 standbydelaylow      10800
 standby              1
 halfdim              1
 hibernatefile        /var/vm/sleepimage
 proximitywake        0
 gpuswitch            2
 powernap             0
 disksleep            10
 standbydelayhigh     86400
 sleep                1 (sleep prevented by sharingd, useractivityd)
 hibernatemode        3
 ttyskeepawake        1
 displaysleep         2
 tcpkeepalive         1
 highstandbythreshold 50
 acwake               0
 lidwake              1
log show --style syslog --start '2019-05-31 00:00:00' | wc -l
 1562157
log show --style syslog --start '2019-05-31 00:00:00' --end '2019-05-31 07:00:00' | grep 'PMRD'
2019-05-31 01:33:46.043541+0200  localhost kernel[0]: PMRD: System Sleep
2019-05-31 01:34:16.800941+0200  localhost kernel[0]: PMRD: System Wake
2019-05-31 01:34:31.060901+0200  localhost kernel[0]: PMRD: System Sleep
2019-05-31 01:35:01.751271+0200  localhost kernel[0]: PMRD: System Wake
2019-05-31 01:35:16.009550+0200  localhost kernel[0]: PMRD: System Sleep
2019-05-31 01:35:46.809967+0200  localhost kernel[0]: PMRD: System Wake
2019-05-31 01:36:01.203380+0200  localhost kernel[0]: PMRD: System Sleep
2019-05-31 01:36:31.761539+0200  localhost kernel[0]: PMRD: System Wake
2019-05-31 01:36:46.031087+0200  localhost kernel[0]: PMRD: System Sleep
2019-05-31 01:37:16.723436+0200  localhost kernel[0]: PMRD: System Wake
2019-05-31 01:37:32.456445+0200  localhost kernel[0]: PMRD: System Sleep
2019-05-31 01:38:02.800643+0200  localhost kernel[0]: PMRD: System Wake
2019-05-31 01:38:58.519978+0200  localhost kernel[0]: PMRD: System SafeSleep
2019-05-31 01:39:24.167452+0200  localhost kernel[0]: PMRD: System SafeSleep
2019-05-31 01:40:01.799306+0200  localhost kernel[0]: PMRD: System SafeSleep Wake
2019-05-31 01:40:18.142921+0200  localhost kernel[0]: PMRD: System SafeSleep
2019-05-31 01:40:55.616962+0200  localhost kernel[0]: PMRD: System SafeSleep Wake
2019-05-31 01:41:11.129164+0200  localhost kernel[0]: PMRD: System SafeSleep
2019-05-31 01:41:48.567301+0200  localhost kernel[0]: PMRD: System SafeSleep Wake
2019-05-31 01:42:04.611552+0200  localhost kernel[0]: PMRD: System SafeSleep
2019-05-31 01:42:40.632701+0200  localhost kernel[0]: PMRD: System SafeSleep Wake
2019-05-31 01:42:56.262092+0200  localhost kernel[0]: PMRD: System SafeSleep
2019-05-31 01:43:33.703435+0200  localhost kernel[0]: PMRD: System SafeSleep Wake
2019-05-31 01:43:49.242617+0200  localhost kernel[0]: PMRD: System SafeSleep
2019-05-31 01:44:26.598513+0200  localhost kernel[0]: PMRD: System SafeSleep Wake
2019-05-31 01:44:42.316342+0200  localhost kernel[0]: PMRD: System SafeSleep
log show --style syslog --start '2019-05-31 01:38:02' --end '2019-05-31 01:38:03' # excerpt - maybe this?
2019-05-31 01:38:02.900304+0200  localhost callservicesd[278]: [com.apple.calls.callservicesd:Default] Updating nearby device routes using devices: <private>
2019-05-31 01:38:02.900347+0200  localhost callservicesd[278]: [com.apple.calls.callservicesd:Default] Not adding any nearby devices because currentCallsSupportNearbyDevices=<private>, supportsPrimaryCalling=<private>, and hasRelayiCloudAccount=<private>
2019-05-31 01:38:02.900433+0200  localhost airportd[180]: ERROR: sharingd (339) is not entitled for com.apple.wifi.join_history, will not allow request
2019-05-31 01:38:02.900949+0200  localhost sharingd[339]: (CoreUtils) [com.apple.CoreUtils:CUWiFiManager] SysMon: WiFi state changed: Connected -> Connected, 0x1 < Unsecured > "Warto było szaleć tak? 5g"
2019-05-31 01:38:02.900952+0200  localhost sharingd[339]: (CoreUtils) [com.apple.CoreUtils:CUSystemMonitor] WiFi state changed: Connected -> Connected, 0x1 < Unsecured >
2019-05-31 01:38:02.905415+0200  localhost kernel[0]: (AppleOnboardSerial) programUART() will skip programRTS()
2019-05-31 01:38:02.934141+0200  localhost kernel[0]: (AppleOnboardSerial) programUART() will skip programRTS()
2019-05-31 01:38:02.934934+0200  localhost kernel[0]: (corecapture) 054632.527762 wlan0.A[5294] powerOn@201:SMC key MSSP=05
2019-05-31 01:38:02.942451+0200  localhost kernel[0]: (corecapture) 054632.535275 wlan0.A[5295] handleDataPacket@9908: Wake up packet received: Data
2019-05-31 01:38:02.942534+0200  localhost kernel[0]: (corecapture) 054632.535362 wlan0.A[5297] Wake Packet Analysis: TCP/IP Packet from 17:252:76:29 with ports 443 --> 62667
2019-05-31 01:38:02.949716+0200  localhost kernel[0]: (corecapture) 054632.542542 wlan0.A[5299] powerOn@22517: Tearing down WoW mode
2019-05-31 01:38:02.952471+0200  localhost kernel[0]: (corecapture) 054632.545297 wlan0.A[5300] handleTCPKeepAliveStatusAsyncCallBack@927:TKO Socket Id 0, Status: Ack Number invalid
2019-05-31 01:38:02.953288+0200  localhost kernel[0]: (corecapture) 054632.546114 wlan0.A[5301] setTCPAliveOffloadEnable@539:TCP Keep Alive Offload: Disabled
2019-05-31 01:38:02.954166+0200  localhost kernel[0]: (corecapture) 054632.546991 wlan0.A[5302] unConfigureKeepAlives@808:UnConfigured Keep Alive ID = 1
2019-05-31 01:38:02.954994+0200  localhost kernel[0]: (corecapture) 054632.547820 wlan0.A[5303] unConfigureKeepAlives@808:UnConfigured Keep Alive ID = 2
2019-05-31 01:38:02.955006+0200  localhost kernel[0]: (corecapture) 054632.547836 wlan0.A[5304] configureEnterpriseAssociatedSleepExit@1193:WNM is Not Supported
2019-05-31 01:38:02.960891+0200  localhost kernel[0]: (AppleOnboardSerial) programUART() will skip programRTS()
2019-05-31 01:38:02.967791+0200  localhost coreaudiod[137]: (BluetoothAudioPlugIn) [com.apple.bluetooth:bluetoothaudiod] hostController general interest notification e0020002
2019-05-31 01:38:02.967829+0200  localhost UserEventAgent[246]: (BluetoothUserAgent-Plugin) [com.apple.bluetooth:User Agent] [BTUserEventAgentController hostControllerPoweredOn] on = 0 off = 100657
2019-05-31 01:38:02.967831+0200  localhost UserEventAgent[246]: (BluetoothUserAgent-Plugin) [com.apple.bluetooth:User Agent] [BTUserEventAgentController messageTracerEventDriven] hostControllerPoweredOn
2019-05-31 01:38:02.967832+0200  localhost bluetoothd[96]: (IOBluetooth) [com.apple.bluetooth:bluetoothd] INIT -- Host Controller 0x7fe094908050 is powered ON
2019-05-31 01:38:02.967832+0200  localhost UserEventAgent[246]: (BluetoothUserAgent-Plugin) [com.apple.bluetooth:User Agent] [BTUserEventAgentController messageTracerEventDriven]
2019-05-31 01:38:02.967893+0200  localhost bluetoothd[96]: (IOBluetooth) [com.apple.bluetooth:bluetoothd] INIT -- Ignoring poweredOn since we have already setup everything
sudo      log show --style syslog --start '2019-05-31 01:37:00' --end '2019-05-31 01:39:00' | grep 'apsd'

https://pastebin.com/ETE1hdp0

  • I think these three lines are a clue to the problem: powerOn@201:SMC key MSSP=05 -- handleDataPacket@9908: Wake up packet received: Data -- Wake Packet Analysis: TCP/IP Packet from 17:252:76:29 with ports 443 --> 62667 – IconDaemon May 31 at 13:40
  • To augment my comment, the lines in the log file indicate that your MPB is being awakened from sleep from a wake packet from a device with IP 17.252.76.29 port 443 - SSL. Do you have a VPN running on your machine, or do you connect to a VPN? – IconDaemon May 31 at 23:07
  • @IconDaemon Nope, that's definitely Apple (the entire 17/8 IP block is theirs). They use HTTPS connections bound to random ports for virtually everything now. – Geoff Nixon Jun 10 at 6:21
1

I'm sorry I can't give any answers directly related to your log.

However, I had similar problems like Macbook not waking up when I open it (Had to force reboot via power button), not successfully getting into sleep mode when I press sleep touchbar shortcut (Screen is blank but touchbar is still lit - also had to force reboot).

In my case I did these two basic first aid steps and it worked out for my cases.

  1. Reset PRAM. (Guide from Apple)

  2. Repair Boot partition. (Guide from Apple)

Well, I hope these two steps that require not too much time solve your problem, but if not, I think you should reinstall OSX. Pretty bad news, but at least good part is unlike Windows ~7 reinstall, OSX Reinstall does not purge userdata(for example, documents, desktop folder, etc) unless you manually reformat your starting disk.

  • BTW Resetting PRAM&Repair partition takes 10~20min in my case, and reinstall OSX takes 1~2hr(depends on wifi speed) – ik1ne May 28 at 16:42
  • It's a brand new Mac (literally used it for 2 weeks), so I guess it must be something else... – 0xDFDFDF May 28 at 18:09
  • @0xDFDFDF This answer does not have a relation to Mac's usage period. Sometimes I had a problem the day after reinstalling the OSX. Also, there was a OSX update at May 13 which can sometimes cause problems, and if so that problem may be solved by PRAM reset. – ik1ne May 29 at 2:24
  • I've just added some fresh logs – 0xDFDFDF May 31 at 6:58
1
+100

If I had to guess, it would be the new proximitywake setting. Do you have any other Apple devices in the vicinity? There's not a lot of documentation on how it works exactly, but others have experienced similar.

https://www.tonymacx86.com/threads/random-wake-up-after-mojave-heres-the-fix.262507/

So maybe try: pmset -a proximitywake 0

If that doesn't work, maybe do what I do, which is set a very low autopoweroffdelay. That is, I just have my machine power off cleanly if its closed for more than an hour. Saves energy, and a regular reboot shouldn't hurt, either.

  • While I can't test it right now, it seems that you might be right, since I have an iPhone as well. I'll mark this as correct to award the points since it's a nice hint. – 0xDFDFDF Jun 2 at 10:36
  • Re: update: well, that's really annoying. Can you try disabling Handoff through System Preferences for a while, and if it still occurs? – Geoff Nixon Jun 10 at 6:22
0

Well, it seems like you don’t fully shut down your MacBook ever. I would guess that some applications can wake up your MacBook; based on the log, it looks like something called dark wake is enabled. And on top of that, something that pops up in later lines (usually the third and fourth) is something with com.apple.. Try killing all the apps you’re not using with Command + Q (such as notes, anything using private-key, or anything else that’s in your log) and then putting it to sleep (without Caffeine, of course).

  • I think "dark wake" is for background tasks that run while the Mac is in sleep mode (Time Machine backups, iCloud syncing, etc.). It's a standard feature that I don't think can be turned off (through the UI, anyway). – daGUY May 25 at 15:30
  • Dark wake can probably be disabled through Terminal, if not the GUI. – Varun Narravula May 25 at 15:31
  • Dark Wake may be Power Nap (System Preferences > Energy Saver > Enable Power Nap checkbox.) – IconDaemon May 26 at 19:41
  • @IconDaemon it was not checked for the battery – 0xDFDFDF May 31 at 6:21
  • @IconDaemon I've just added some fresh logs – 0xDFDFDF May 31 at 6:58
0

Couple of things to try:

Open up activity monitor, set to view all processes, in the list of processes right click on the header and turn on preventing sleep. This may highlight something new.

Have you tried shutting down the sharingd and useractivityd daemons?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .