MacBook Pro 2018 switch from sleep to DarkWake in loop. How to diagnose

dockhigh sierrasleep-wakethunderbolt

Having a lot of issues with MacBook Pro 2018 (macOS 10.13.6) connected to a single ThunderBolt 3 cable to a CalDigit TS3 docking station.

When going to sleep sometimes it starts switching to DarkWake and back to sleep in constant loop. This is particularly annoying because the docking station is connected via audio jack to some external speakers and every time it turns on you hear a low bass "tock". Anyway I guess the sleep-wake loop is not healthy for display and battery.

I've tried a lot of different setups and sometimes sleep is good and continuous, but cannot really get to the real cause.

Things I've tried:

  • Disabled PowerNap
  • Disabled Network activation (but in logs I keep seeing TCPKeepAlive=active)
  • Resetting SMC
  • Disabling BT
  • Disabling "BT device can wake up system"
  • Gradually disconnecting hardware
  • Disabling "stop disks when possible" (CalDigit tech-support hint)

Problems appearing sometimes again, every time the logs are slightly different.

This is the latest power management log: now there's also a thermal warning.

03:32:25.682387 +0200   powerd  [System: SRPrevSleep kCPU]
03:32:25.683183 +0200   powerd  SleepService: window begins with cap time=86400 secs
03:32:25.683713 +0200   powerd  DarkWake from Normal Sleep [CDNP] due to EC.Thunderbolt/Maintenance:
03:32:25.684275 +0200   powerd  hibmode=3 standbydelay=10800
03:32:25.691540 +0200   powerd  
03:32:25.692761 +0200   powerd  [System: PushSrvc SRPrevSleep kCPU]
03:32:30.731576 +0200   powerd  [System: PushSrvc SRPrevSleep kCPU]
03:32:34.534926 +0200   powerd  Entering Sleep state due to 'Dark Wake Thermal Emergency':TCPKeepAlive=active
03:32:34.536879 +0200   powerd  [System: PushSrvc SRPrevSleep kCPU]
03:32:34.537423 +0200   powerd  SleepService: window has terminated.
03:32:39.278328 +0200   powerd  [System: SRPrevSleep kCPU]
03:32:39.550590 +0200   powerd  
03:32:39.551560 +0200   powerd  
03:32:57.901601 +0200   powerd  
03:32:57.924422 +0200   powerd  [System: SRPrevSleep kCPU]
03:32:57.990973 +0200   powerd  [System: PrevIdle SRPrevSleep kCPU]
03:33:09.381060 +0200   powerd  [System: SRPrevSleep kCPU]
03:33:09.381661 +0200   powerd  SleepService: window begins with cap time=86400 secs
03:33:09.382223 +0200   powerd  DarkWake from Normal Sleep [CDNP] due to EC.Thunderbolt/Maintenance:
03:33:09.382680 +0200   powerd  hibmode=3 standbydelay=10800
03:33:09.389934 +0200   powerd  
03:33:09.390987 +0200   powerd  [System: PushSrvc SRPrevSleep kCPU]
03:33:14.430394 +0200   powerd  [System: PushSrvc SRPrevSleep kCPU]
03:33:18.286223 +0200   powerd  Entering Sleep state due to 'Dark Wake Thermal Emergency':TCPKeepAlive=active
03:33:18.290284 +0200   powerd  [System: PushSrvc SRPrevSleep kCPU]
03:33:18.291146 +0200   powerd  SleepService: window has terminated.
03:33:23.001823 +0200   powerd  [System: SRPrevSleep kCPU]
03:33:23.305851 +0200   powerd  

I have other logs showing different messages (cannot really connect them to a specific hardware/software configuration), like this:

03:20:35.990712 +0200   powerd  Entering Sleep state due to 'Maintenance Sleep':TCPKeepAlive=active
03:20:41.000563 +0200   powerd  
03:20:41.001486 +0200   powerd  
05:20:42.506452 +0200   powerd  
05:20:42.526068 +0200   powerd  [System: PrevIdle DeclUser BGTask SRPrevSleep kCPU kDisp]
05:20:42.535903 +0200   powerd  [System: PrevIdle DeclUser BGTask kDisp]
05:20:44.993979 +0200   powerd  [System: PrevIdle DeclUser BGTask kDisp]
05:20:53.553421 +0200   powerd  [System: PrevIdle DeclUser BGTask kDisp]
05:20:53.953029 +0200   powerd  [System: PrevIdle DeclUser BGTask SRPrevSleep kCPU kDisp]
05:20:53.953925 +0200   powerd  DarkWake from Normal Sleep [CDN] due to EC.RTC/Maintenance:
05:20:53.954440 +0200   powerd  hibmode=3 standbydelay=10800
05:20:53.964825 +0200   powerd  
05:20:53.966604 +0200   powerd  [System: PrevIdle DeclUser BGTask SRPrevSleep kCPU kDisp]
05:20:54.850831 +0200   powerd  [System: PrevIdle DeclUser SRPrevSleep IPushSrvc kCPU kDisp]
05:20:59.029604 +0200   powerd  [System: DeclUser BGTask SRPrevSleep kCPU kDisp]
05:21:38.969290 +0200   powerd  [System: DeclUser SRPrevSleep kCPU kDisp]
05:21:38.974772 +0200   powerd  Entering Sleep state due to 'Maintenance Sleep':TCPKeepAlive=active

Spare question: What "EC." stands for?

I cannot really target the real cause.

Current HW connections:

MacBookPro -> Thunderbolt 3 cable with PD -> CalDigit TS3 -> Dell 2013 Monitor via DisplayPort + Ethernet + Dell USB3 hub via USB3 -> Amazon USB3 hub -> Wacom tablet via USB

Questions:

  • Best ways to diagnose?
  • Any workarounds for disabling DarkWake, if is it safe?

UPDATE: Just found disabling Find My Mac could be triggering TCPKeepAlive=false, but I'm not sure if it will really last. Last sleep cycle was perfect and log says:

19:35:43.852487 +0200   powerd  Entering Sleep state due to 'Idle Sleep':TCPKeepAlive=inactive

…but should I really disable useful Find My Mac for that?.

Best Answer

You could force disabling TCPKeepAlive when on battery power. However, this may reduce the functionality of Find My Mac (notably cannot find your mac when it's sleeping).

Run this command from the Terminal:

sudo pmset -b tcpkeepalive 0

In any case, I'd argue if your mac is stolen, it won't be able to connect to the Internet anyway unless the thief logs in as a guest (using the Safari-only login mode) and configures Wi-Fi for it to use.