Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Alwis

macrumors 6502
Original poster
Jan 12, 2017
439
506
Who would guessed it, the sleep issues I had for several versions of macOS are still present in Sonoma, just worse...

I few days ago, I noticed that my iMac goes to Darkwake very very often, somtimes it sleeps only for 1-2 minutes before woken again.

The logs show,.
Code:
DarkWake from Standby [CDN] : due to EC.WoL/Network

I have WOL disabled, so I did some more digging, pmset shows the following wake reason (MAC address and my own IP are obsufcated):
Code:
 kernel: (AppleBCM5701Ethernet) AppleBCM5701Ethernet [en0]: Wake reason: Enet.TCPData - Incoming data on a kept-alive socket with TCP from 0:00:00:00:00:00 17.57.146.54.5223 to 1.2.3.4.49210

The port 5223 indicates, that this is related to the Apple push services. I did test disabling the network connection before putting the Mac to sleep. This resolves this problem, but then the Darkwakes because of maintenance are increasing. At least only to one wake every hour.

I guess Apple will never fix this and it is just an other indicator of Apple software quality in these times. But yea, I am glas to have a new text cursor animation, that is way more important than fixing bugs...
 
  • Like
Reactions: Emmanuel.th

ApexDE

macrumors regular
Nov 27, 2008
113
38
i have the same problem, mac wakes every hour because of rtc/maintenance with sonoma. It didn't with ventura. Powernap is set to 0, tcpkeepalive is set to 0, womp is set to 0.

Hourly wake is VERY annoying.

log with wake reasons:

2023-10-27 03:38:37 +0200 DarkWake DarkWake from Deep Idle [CDN] : due to NUB.SPMI0Sw3IRQ nub-spmi.0x02 rtc/Maintenance Using AC (Charge:0%) 45 secs


2023-10-27 04:18:34 +0200 DarkWake DarkWake from Deep Idle [CDN] : due to NUB.SPMI0Sw3IRQ nub-spmi.0x02 rtc/Maintenance Using AC (Charge:0%) 44 secs


2023-10-27 05:39:37 +0200 DarkWake DarkWake from Deep Idle [CDN] : due to NUB.SPMI0Sw3IRQ nub-spmi.0x02 rtc/Maintenance Using AC (Charge:0%) 45 secs


2023-10-27 06:40:38 +0200 DarkWake DarkWake from Deep Idle [CDN] : due to NUB.SPMI0Sw3IRQ nub-spmi.0x02 rtc/Maintenance Using AC (Charge:0%) 45 secs


2023-10-27 07:41:37 +0200 DarkWake DarkWake from Deep Idle [CDN] : due to NUB.SPMI0Sw3IRQ nub-spmi.0x02 rtc/Maintenance Using AC (Charge:0%) 45 secs

pmset -g :

System-wide power settings:


Currently in use:


standby 0


Sleep On Power Button 1


autorestart 0


SleepServices 0


powernap 0


networkoversleep 0


disksleep 0


sleep 0 (sleep prevented by powerd, bluetoothd, sharingd)


ttyskeepawake 1


displaysleep 10


tcpkeepalive 0


womp 0
 

krvld

macrumors member
Jul 20, 2023
62
49
Updated to Sonoma only to come to this thread. Here we go again...
  • 2023-11-05 21:45:35 +0200 DarkWake DarkWake from Deep Idle [CDN] : due to NUB.SPMI0Sw3IRQ nub-spmi.0x02 rtc/Maintenance Using BATT (Charge:69%) 45 secs
  • 2023-11-05 22:46:35 +0200 DarkWake DarkWake from Deep Idle [CDN] : due to NUB.SPMI0Sw3IRQ nub-spmi.0x02 rtc/Maintenance Using BATT (Charge:67%) 45 secs
  • 2023-11-05 23:47:35 +0200 DarkWake DarkWake from Deep Idle [CDN] : due to NUB.SPMI0Sw3IRQ nub-spmi.0x02 rtc/Maintenance Using BATT (Charge:67%) 45 secs
  • 2023-11-06 00:48:35 +0200 DarkWake DarkWake from Deep Idle [CDN] : due to NUB.SPMI0Sw3IRQ nub-spmi.0x02 rtc/Maintenance Using BATT (Charge:67%) 45 secs
  • 2023-11-06 01:49:35 +0200 DarkWake DarkWake from Deep Idle [CDN] : due to NUB.SPMI0Sw3IRQ nub-spmi.0x02 rtc/Maintenance Using BATT (Charge:66%) 45 secs
  • 2023-11-06 06:01:00 +0200 DarkWake DarkWake from Deep Idle [CDN] : due to NUB.SPMI0Sw3IRQ nub-spmi.0x02 rtc/Maintenance Using BATT (Charge:66%) 45 secs
I did a lot a work to fix sleep issues on Ventura at it still required to turn off both WiFi and Bluetooth before closing the lid (used shortcut). But the Macbook was sleeping with zero pmset -log entries as well as the battery lever graph showing empty space.

Now it's either downgrade to Ventura or trying to find a solution again. I'll come back to this thread if I manage to find any.
 

ApexDE

macrumors regular
Nov 27, 2008
113
38
my guess is: we need to find out which process is accessing the file "/Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist" and look in/around that process.
 

krvld

macrumors member
Jul 20, 2023
62
49
my guess is: we need to find out which process is accessing the file "/Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist" and look in/around that process.
Mine is already set to:
  • sudo pmset schedule cancelall
  • sudo pmset repeat cancel
  • sudo chflags schg /Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist

It was the final solution for me on Ventura.
 
  • Like
Reactions: prefuse07

ApexDE

macrumors regular
Nov 27, 2008
113
38
Hello @krvld

sadly, that doesn't work under Sonoma anymore :(


I believe we should look at "UserEventAgent" and "calaccessd" according to Wake Events.
 
Last edited:

smirking

macrumors 68040
Aug 31, 2003
3,941
4,008
Silicon Valley
This seems to happen every time a new MacOS gets released for like the past 15 years. It used to be so severe that I'd avoid upgrading my OS for at least 6 months after a new one got released because I figured it would take at minimum 6 months before the sleep issue would get fixed again.

I remember someone even had a program called "Please Sleep" that you could install to encourage your Mac to sleep when it was supposed to sleep. That worked beautifully for me, but then each new OS would break it.
 

ApexDE

macrumors regular
Nov 27, 2008
113
38
@smirking

you are damn right, i will follow that path in the future too. I had high hopes that another longstanding bug regarding external drives could have been fixed, for my disappointment it was not. One bug remaining and a new one earned ;)
 
  • Like
Reactions: smirking

krvld

macrumors member
Jul 20, 2023
62
49
Couldn't find a solution, downgraded to Ventura and restored from a Time Machine backup.

Back to proper sleep we go.
1699424062077.jpeg
1699424071224.jpeg


I really enjoyed Sonoma's look and performance. It paired really well with iOS 17 Update. Sad...
 

maccan

macrumors regular
Feb 22, 2019
100
39
Hello @krvld

sadly, that doesn't work under Sonoma anymore :(


I believe we should look at "UserEventAgent" and "calaccessd" according to Wake Events.
Hi,

Have exactli the same problem. Managed it in Ventura to overcome the problem with
  • sudo pmset schedule cancelall
  • sudo pmset repeat cancel
  • sudo chflags schg /Library/Preferences/SystemConfiguration/com.apple.AutoWake.plist
+ turning OFF Bluetooth and WiFi + tcpkeepalive 0!

I would not conclude it is not working any more. I would rather suggest there is a new DarkWake scenario introduced with Sonoma. If you execute in a terminal:

pmset -g log > pmset.txt

this will pipe the output of pmset -g log to the file "pmset.txt". This file you can look with an editor in order to see what's going on:

By doing so I see multiple occurrences of the following:

2023-11-12 10:46:34 +0100 Sleep Entering Sleep state due to 'Software Sleep pid=2547':TCPKeepAlive=disabled Using AC (Charge:0%) 4970 secs
2023-11-12 10:46:37 +0100 Wake Requests [*process=powerd request=CSPNEvaluation deltaSecs=7242 wakeAt=2023-11-12 12:47:19]
2023-11-12 10:46:37 +0100 PM Client Acks Delays to Sleep notifications: [com.apple.apsd is slow(2496 ms)]
2023-11-12 12:09:20 +0100 Assertions PID 97(powerd) Created InternalPreventSleep "Holding in darkwake for up to 20 seconds to query model for inactivity prediction" 00:00:00 id:0x0xd00009f8d [System: DeclUser SRPrevSleep kCPU kDisp]
2023-11-12 12:09:20 +0100 Assertions PID 97(powerd) Released InternalPreventSleep "Holding in darkwake for up to 20 seconds to query model for inactivity prediction" 00:00:00 id:0x0xd00009f8d [System: DeclUser kDisp]
2023-11-12 12:09:20 +0100 Assertions PID 273(mDNSResponder) Created MaintenanceWake "mDNSResponder:maintenance" 00:00:00 id:0x0xd00009f91 [System: PrevIdle DeclUser BGTask SRPrevSleep kCPU kDisp]
2023-11-12 12:09:21 +0100 Assertions PID 273(mDNSResponder) Released MaintenanceWake "mDNSResponder:maintenance" 00:00:00 id:0x0xd00009f91 [System: PrevIdle DeclUser BGTask kDisp]
2023-11-12 12:09:24 +0100 Assertions PID 97(powerd) Created InternalPreventSleep "Network wake delay proxy assertion" 00:00:00 id:0x0xd00009f95 [System: DeclUser SRPrevSleep kCPU kDisp]
2023-11-12 12:09:24 +0100 DarkWake DarkWake from Normal Sleep [CDN] : due to EC.WoL/Network Using AC (Charge:0%) 37 secs
2023-11-12 12:09:24 +0100 WakeDetails DriverReason:pci8086,15f0 - DriverDetails:
2023-11-12 12:09:24 +0100 HibernateStats hibmode=0 standbydelaylow=0 standbydelayhigh=0 23
2023-11-12 12:09:24 +0100 WakeTime WakeTime: 3.899 sec


From this you can see the following:
At 2023-11-12 10:46:34 I put the mac to sleep with Apple->Sleep menu command.
At 2023-11-12 10:46:37 A Wake Request is scheduled with a delay of deltaSecs=7242 seconds as you can see from the following entry:
2023-11-12 10:46:37 +0100 Wake Requests [*process=powerd request=CSPNEvaluation deltaSecs=7242 wakeAt=2023-11-12 12:47:19]

So before the machine actually sleeps, this wake request is already in place causing the machine to wakeup after 7242 secs (2 Hours). And it does as you can see in the statement:
2023-11-12 12:09:24 +0100 WakeTime WakeTime: 3.899 sec

The wakeup request is "CSPNEvaluation".

My questions are: What is "CSPNEvaluation" and which process/program is requesting it at each sleep?
Does CSP means Content Security Policy? Maybe introduced in Webkit?

Can you check if you have such entries in your pmset -g log?

Best regards
 
  • Like
Reactions: jmstilly and krvld

trifona

macrumors member
Oct 22, 2007
78
13
I'm having this issue on my 2019 Intel i9 MBP. When I'm not using the MBP I like putting it to sleep and disconnecting it from power. Every morning now for the past week I plug in th MBP to find the battery has drained down to zero. LAst night I put it to sleep, kept it connected to power, and yet the battery had drained down to 19%. What is going? Running Sonoma 14.1.1.
 

maccan

macrumors regular
Feb 22, 2019
100
39
I'm having this issue on my 2019 Intel i9 MBP. When I'm not using the MBP I like putting it to sleep and disconnecting it from power. Every morning now for the past week I plug in th MBP to find the battery has drained down to zero. LAst night I put it to sleep, kept it connected to power, and yet the battery had drained down to 19%. What is going? Running Sonoma 14.1.1.
Look at the output of "pmset -g log"! It is probably the best way to find out what is going on.
Can you look out for "CSPNEvaluation" events?

Good luck!
 

maccan

macrumors regular
Feb 22, 2019
100
39
I will if you can help me navigate to that :)
See my post above! It states the following:

Start a Terminal and execute the following commands:
1. cd Desktop
2. pmset -g log > pmset.txt

On the Desktop you will get a file "pmset.txt".
Double-click on it! -> TextEdit will open and you can look at its content.

Search for "CSPNEvaluation"
 
  • Like
Reactions: Queen6

trifona

macrumors member
Oct 22, 2007
78
13
Thank you maccan.

2023-11-13 02:37:54 -0500 Wake Requests [process=mDNSResponder request=Maintenance deltaSecs=7198 wakeAt=2023-11-13 04:37:52 info="upkeep wake"] [process=powerd request=AdaptiveWake deltaSecs=14055 wakeAt=2023-11-13 06:32:10] [process=powerd request=TCPKATurnOff deltaSecs=29885 wakeAt=2023-11-13 10:56:00] [*process=powerd request=CSPNEvaluation deltaSecs=1098 wakeAt=2023-11-13 02:56:12] [process=powerd request=UserWake deltaSecs=22780 wakeAt=2023-11-13 08:57:35 info="com.apple.alarm.user-invisible-com.apple.calaccessd.travelEngine.periodicRefreshTimer,488"]
 
  • Like
Reactions: ApexDE

maccan

macrumors regular
Feb 22, 2019
100
39
Thank you maccan.

2023-11-13 02:37:54 -0500 Wake Requests [process=mDNSResponder request=Maintenance deltaSecs=7198 wakeAt=2023-11-13 04:37:52 info="upkeep wake"] [process=powerd request=AdaptiveWake deltaSecs=14055 wakeAt=2023-11-13 06:32:10] [process=powerd request=TCPKATurnOff deltaSecs=29885 wakeAt=2023-11-13 10:56:00] [*process=powerd request=CSPNEvaluation deltaSecs=1098 wakeAt=2023-11-13 02:56:12] [process=powerd request=UserWake deltaSecs=22780 wakeAt=2023-11-13 08:57:35 info="com.apple.alarm.user-invisible-com.apple.calaccessd.travelEngine.periodicRefreshTimer,488"]
This means:
The system was requested several Wake requests at the time specified. Some of these you can get rid of by disabling Apple diagnostics + Apple advertisment. But the "CSPNEvaluation" Wake Request is new in Sonoma and nobody seems to know what it is actually used for, what it is doing or which process scheduled this Wake Request.

But one thing is for sure: All this request will power up your machine at the specified time (see wakeAt=...). Now if for some reason the system is not entering sleep again, it will stay on and will drain your battery.

We all would wish that Apple would introduce an "ultimate Sleep Button" which sleeps the machine until the user wants to wake it up by a keystroke.
 

maccan

macrumors regular
Feb 22, 2019
100
39
In order to understand the wake request from CSPNEvaluation I was searching for CSPN in the internet. Could CSPN be related to hardware security keys Apple introduced previously? There is a YubiKey 5 Series CSPN hardware security key available. Has anybody an idea in which context CSPN is used here?
 

maccan

macrumors regular
Feb 22, 2019
100
39
In discussions.apple.com someone mentioned that CSPN means CoreSmartPowerNap. Despite disabling PowerNap in the SystemSettings, in Sonoma lots of users have this problem causing battery drain on MacBooks, switching on peripherals on hourly base or causing constantly running fans on Mac Pro machines.
 
  • Like
Reactions: ApexDE

ApexDE

macrumors regular
Nov 27, 2008
113
38
yes, there seems to be a solution in sight. Under /System/Library/FeatureFlags/Domain/ is a file called powerd.plist.

Look at its contents:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>CoreSmartPowerNap</key>
        <dict>
                <key>Enabled</key>
                <true/>
        </dict>
</dict>
</plist>

So, there IS a switch, we just need to find out how to push it ;)
 
  • Like
Reactions: Alwis and krvld

maccan

macrumors regular
Feb 22, 2019
100
39
yes, there seems to be a solution in sight. Under /System/Library/FeatureFlags/Domain/ is a file called powerd.plist.

Look at its contents:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>CoreSmartPowerNap</key>
        <dict>
                <key>Enabled</key>
                <true/>
        </dict>
</dict>
</plist>

So, there IS a switch, we just need to find out how to push it ;)
Thank you very much for working this out! Let's see...
 

ApexDE

macrumors regular
Nov 27, 2008
113
38
regards go to a user named "sourcelocation" on another forum, he found that, i just wanted to share. There are ideas how to stop the hourly wakes/CSPN, we are investigating. I report back here when we found a solution.
 
  • Like
Reactions: krvld

maccan

macrumors regular
Feb 22, 2019
100
39
yes, there seems to be a solution in sight. Under /System/Library/FeatureFlags/Domain/ is a file called powerd.plist.

Look at its contents:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>CoreSmartPowerNap</key>
        <dict>
                <key>Enabled</key>
                <true/>
        </dict>
</dict>
</plist>

So, there IS a switch, we just need to find out how to push it ;)
On another forum a solution was found by somebody:
#------------------------------------------------------------------------------
Having investigated this further I found that there is a MacOS FeatureFlag for enabling CoreSmartPowerNap in powerd.plist in the system folder /System/Library/FeatureFlags/Domain/

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CoreSmartPowerNap</key>
<dict>
<key>Enabled</key>
<true/>
</dict>
</dict>
</plist>



We cant change this plist directly because the file is in the secure system enclave but another user pointed out that we can override MacOS FeatureFlags by setting in them in the /Library/Preferences/FeatureFlags/Domain/ folder.

I've tried this approach and since implementing I have not seen any CSPNEvaluation wake reasons.

If you want to try this for yourself do the following :-

1. Open Terminal

2. Create the folder structure in terminal with: sudo mkdir -p /Library/Preferences/FeatureFlags/Domain/

3. Copy the above code into a editor and change the boolean flag <true/> to <false/>

4. Save the file as powerd.plist into the new folder: /Library/Preferences/FeatureFlags/Domain/

5. Reboot
#------------------------------------------------------------------------------

Tried and tested this:
1. put the machine into sleep
2. wake it up
3. pmset -g log > pmset.txt.
4. Voila -> no CSPNEvaluation Wake Request for this sleep action

Best regards!
 

ApexDE

macrumors regular
Nov 27, 2008
113
38
my first tests since yesterday using above method confirms this. Lets cross the fingers that it persists ;)
 
  • Like
Reactions: krvld

maccan

macrumors regular
Feb 22, 2019
100
39
Switching of CSPNEvaluation worked great!
The system is now sleeping properly!

No wake up in 12h
2023-11-16 19:18:21 +0100 PM Client Acks Delays to Sleep notifications: [com.apple.apsd is slow(17341 ms)]
2023-11-17 08:06:00 +0100 Assertions

Best regards!
 
  • Like
Reactions: krvld and ApexDE
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.