Display comes back on when it is time to sleep

Number:rdar://FB7703338 Date Originated:5/15/2020
Status:Open Resolved:
Product:macOS Product Version:macOS Mojave 10.14.6
Classification:Sleep/Wake Reproducible:Usually
Since upgrading my MacBook Pro to Mojave, it has had a semi-consistent problem with sleep.

Screen saver is set to activate after 20 minutes. Energy saving preferences are set to turn off the display and sleep at 60 minutes.

When it fails, the symptoms are:
1. At 20 minutes after last activity, the screen saver starts as expected.
2. At 60 minutes after last activity, the display starts to dim...
3. But then it comes back to life. The screen saver is off. The computer does not sleep.
4. Go to step #1 and repeat forever.

That is, it will continue to cycle: screen on for 20 minutes, screen saver for 40, screen on for 20 minutes, screen saver for 40, forever.

But the problem does not always occur!  Sometimes it sleeps normally at 60 minutes as expected.  The key is, that IF it fails to sleep at 60 minutes, THEN it will continue this pattern until there is some user activity.  At that point one of two things will happen: a) 60 minutes later it will sleep normally, or b) the problem will occur again, but cycling 20/60 minutes after this activity.

I can't figure this out. I've tried ensuring nothing is plugged in. pmset says there is nothing blocking sleep.  And notice that they symptom isn't like something is *blocking* the sleep, it is more like at the moment it tries to sleep it generates something that is construed as user activity, which thus wakes up the display and starts the 20 & 60 minute timers all over again.  But consistently!

This problem did not occur with High Sierra.

I captured the Sysdiagnose shortly after an occurrence of the problem, meaning it is at the 60 minute mark when the display lit up.

My current theory is that there is something timer related, such as if the timer for going to sleep is coinciding with the timer for the hourly Time Machine backup.

Update 5/25/2020:

I believe that this issue is connected to System Preferences > Energy Saver > Automatic graphics switching, i.e. that the issue only occurs when graphics switching is enabled.  That would also explain why the problem occurs on my MacBook Pro but not on my iMac.

It appears that the built-in Classic screen saver (which just displays a series of images) triggers switching to the AMD Radeon Pro 455 graphics accelerator. You can see this just by going to the Screen Saver tab in System Preferences.  With the screen saver off, and no other applications running, it switches back to the Intel HD Graphics 530.

I don't know what the connection is to the sleep problem. When it is time to transition to sleep does it stop the screen saver but that triggers a graphics switch which then wakes it back up?


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!