Skip to content

App might not release power management assertions in some circumstances #3486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gonzalezcalleja opened this issue Oct 11, 2024 · 7 comments
Closed
Assignees
Labels
bug Something isn't working done All tasks are completed released Released
Milestone

Comments

@gonzalezcalleja
Copy link

Hi,

After last updates (now v.3.1.1) with macOS 15.0.1, In activity Monitor, BetterDisplay is always "YES" in Preventing Sleep so I can't sleep my computer.

This issue has never happened before.

@waydabber waydabber added the investigating Investigating issue label Oct 11, 2024
@waydabber
Copy link
Owner

Does this happen right on after app startup or is there an activity that triggers this behavior?

@waydabber waydabber self-assigned this Oct 11, 2024
@waydabber
Copy link
Owner

Note: the app intentionally blocks sleep in specific circumstances, like mode switch or reinitialization to prevent the system from entering to sleep when only one display is connected. This however should be temporary, not continuous.

These are the events when the app attempts to prevent sleep for a while (for 10 seconds after trigger):

  • Connecting/disconnecting a display
  • Mode switch
  • Low level connection mode switch
  • Setting custom EDID
  • Setting factory EDID
  • Changing HDR mode
  • Applying display system configuration change
  • VMM7100 reset

If you see the app continuously preventing sleep, then something must be wrong/stuck somehow, we should figure out what.

@waydabber waydabber added bug Something isn't working and removed investigating Investigating issue labels Oct 11, 2024
@waydabber
Copy link
Owner

Hmm. I was able to reproduce the issue. It seems like the sleep prevention assertion is not released properly in some situations. The OS should still let sleep back after about a minute or so anyway, but this is not ideal for sure:

pmset -g assertions | grep -i sleep

   PreventUserIdleDisplaySleep    0
   PreventSystemSleep             0
   PreventUserIdleSystemSleep     1
   pid 17573(BetterDisplay): [0x0001513b00078257] 00:04:15 PreventSystemSleep named: "Temporarily prevent sleep during operation that might cause display signal loss"  
   pid 1066(sharingd): [0x000151fe000183a8] 00:01:00 PreventUserIdleSystemSleep named: "Handoff"  
   pid 572(powerd): [0x00014e710001a3ed] 00:16:09 PreventUserIdleSystemSleep named: "Powerd - Prevent sleep while display is on"  

@waydabber waydabber added in progress Implementing internal pre-release Enable internal pre-releases under Settings/Applications/Updates labels Oct 11, 2024
@waydabber waydabber added this to the v3.1.2 milestone Oct 11, 2024
@gonzalezcalleja
Copy link
Author

Hi @waydabber, thanks for your fast support.

Reading your first post I remembered that I wrote a hammerspoon script for restart BetterDisplay when computer sleep/wakeup for a issue with dummy displays in apple sillicon: https://ptb.discord.com/channels/903276571773771796/903276571773771799/1076823918557528137

Removing this script, BetterDisplay is in Preventing Sleep mode only a moment.

@waydabber
Copy link
Owner

Thanks for the additional info. Nevertheless, the fact remains that there is a bug in the app as the PreventUserIdleSystemSleep assertion is not released properly. I am investigating the cause and will provide a fix. :)

@waydabber waydabber changed the title Preventing sleep: Yes - Can't sleep App does not release PreventUserIdleSystemSleep assertion properly in some circumstances Oct 11, 2024
@waydabber waydabber changed the title App does not release PreventUserIdleSystemSleep assertion properly in some circumstances App might not release power management assertions in some circumstances Oct 11, 2024
@waydabber waydabber added done All tasks are completed and removed in progress Implementing labels Oct 11, 2024
@waydabber
Copy link
Owner

I'll release a stable update with a fix for this as it can actually be an annoying issue. Thanks @gonzalezcalleja for reporting this!

@waydabber waydabber added released Released and removed internal pre-release Enable internal pre-releases under Settings/Applications/Updates labels Oct 11, 2024
@waydabber
Copy link
Owner

The v3.1.2 fixing specifically this issue is now out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working done All tasks are completed released Released
Projects
None yet
Development

No branches or pull requests

2 participants