Skip to content
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

Godot prevents automatic sleeping due to the audio system #28039

Open
robgraeber opened this issue Apr 15, 2019 · 17 comments
Open

Godot prevents automatic sleeping due to the audio system #28039

robgraeber opened this issue Apr 15, 2019 · 17 comments

Comments

@robgraeber
Copy link

robgraeber commented Apr 15, 2019


Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.


Godot version: 3.1

OS/device including version: Mac OSX 10.14

Issue description:
The godot editor is preventing Mac's from automatically sleeping, according to the activity monitor.

Screen Shot 2019-04-14 at 7 45 14 PM

Steps to reproduce: Open any godot project.

@akien-mga
Copy link
Member

Might be due to requiring the high perf GPU. This makes sense for exported games, but should maybe not be enabled by default for the editor itself.

@codespren
Copy link

Can confirm this bug. To prevent it you have to close godot every time when you stop using computer. Otherwise Godot will burn your battery when you think the laptop is asleep.

This is very problematic because when we talk about macbooks and other modern laptops, people may take a break (and put laptop asleep) easily 10 times a day. To use godot you should remember to close it every single time. If you don't, then when you next time try to use computer you find out that Godot has drained all the battery.

So first it might sound like a small inconvenience but for some people and use cases this is a critical, software breaking bug.

Perhaps editor setting that allows users to switch this behaviour off would solve the problem?

@Calinou
Copy link
Member

Calinou commented Sep 28, 2019

@codespren Can't you still put the laptop to sleep manually in this case? This is generally what you should be doing to maximize its battery life, so it doesn't idle for a few minutes before going to sleep.

I'm afraid making Godot use integrated graphics by default isn't an option, as it will probably feel sluggish on Retina displays (even when working on a 2D game). We could have a checkbox for this in the Editor Settings, but then, it should be implemented for all platforms.

Also, which MacBook model do you have?

@codespren
Copy link

It's MacBook Pro, Intel Core i5, 8 Gb memory and Intel Iris 1536 MB graphics card with MacOS Mojave. So I'm actually using Godot with integrated graphic card and doing 3D-stuff and Godot runs great but I'm using only lowpoly objects and don't use any demanding graphic settings.

I can put it sleep manually by selecting sleep from menu or by closing lid and it behaves same way when Godot is running and when it is not. I only found out that Godot is not actually sleeping because first I left Godot running just like other software and later when I tried to continue working the battery was empty.

I agree that It's better to use better graphics by default. Most users probably expect that. I also did some testing and other 3D software are also preventing sleeping, tested it with Unity and Blender. I'm starting to change my mind about this. Maybe laptop users should just deal with it and close those programs manually. Or write a script that closes them automatically when the laptop goes sleep.

@Dentrax
Copy link
Contributor

Dentrax commented Mar 23, 2020

Exactly same issue with Macbook Pro, Godot quickly reduced my battary from percent 90 to 15 in 2 hours, while in sleep.

Screen Shot 2020-03-23 at 13 56 41

Battery drain became stable after closing Godot. @akien-mga

@ellenhp
Copy link
Contributor

ellenhp commented Feb 11, 2021

I'm going to look into this after work because it's bugging me. It looks like it might be the audio system preventing sleep. Perhaps the editor is always playing silent audio even if there aren't any active audio sources?

Before and after closing godot:

~/dev/godot/godot 21/02/11 09:04:42 [3.2] $ pmset -g

System-wide power settings:
Currently in use:
 powernap             1
 sleep                1 (sleep prevented by powerd, coreaudiod)
 Sleep On Power Button 1
 ttyskeepawake        1
 tcpkeepalive         1
 disksleep            10
 standby              1
 displaysleep         2
~/dev/godot/godot 21/02/11 09:05:06 [3.2] $ pmset -g

System-wide power settings:
Currently in use:
 powernap             1
 sleep                1 (sleep prevented by powerd)
 Sleep On Power Button 1
 ttyskeepawake        1
 tcpkeepalive         1
 disksleep            10
 standby              1
 displaysleep         2

@Calinou
Copy link
Member

Calinou commented Feb 11, 2021

I'm going to look into this after work because it's bugging me. It looks like it might be the audio system preventing sleep. Perhaps the editor is always playing silent audio even if there aren't any active audio sources?

In this case, this issue is a duplicate of #38154. See also this workaround:

Either way, you can start the editor with the --audio-driver Dummy command-line argument if you don't need it to play sound. The running project should still be able to play sound if you do this.

@ellenhp
Copy link
Contributor

ellenhp commented Feb 12, 2021

I confirmed that it's the audio system. I have a hacky fix, and will continue discussion on #38154.

@p10tr3k
Copy link
Contributor

p10tr3k commented Nov 12, 2022

Still exists on MacOs Ventura and Godot 3.5.1
Any plans for a fix in the near future?

@Calinou
Copy link
Member

Calinou commented Nov 12, 2022

Any plans for a fix in the near future?

There's no ETA for resolving this issue, as contributors work on a best-effort basis. You can test #63458 locally, but it needs a rebase (and a port to 4.0's largely rewritten audio system) before it can be merged.

@akien-mga
Copy link
Member

CC @bruvzg

@nabil-alsabah
Copy link

I'm using Godot 4 Beta 7 and the issue still hasn't been resolved...

@AndreiSchapov
Copy link

4.0 Beta 9, still here

@xentripetal
Copy link
Contributor

xentripetal commented Feb 15, 2023

4.0 RC2 still prevents sleep regardless of #71325

Screenshot 2023-02-14 at 11 33 12 PM

@Riteo
Copy link
Contributor

Riteo commented Feb 15, 2023

@xentripetal #71325 has nothing to do with this issue, this happens due to the audio system staying on at all times.

@rm-code
Copy link

rm-code commented Mar 5, 2023

Not sure if this is a side effect of this issue (if not I can open a new issue), but yesterday I noticed that when I close my MBP with Godot still running it also doesn't really go to sleep. The worse part however is, that the fans stop working but the MBP still produces a lot of heat. When I went back to it a few hours later it was pretty hot, and when I opened it the fans kicked in immediately.

Can anybody else confirm if this is also caused by the audio system?

@Calinou
Copy link
Member

Calinou commented May 8, 2023

Not sure if this is a side effect of this issue (if not I can open a new issue), but yesterday I noticed that when I close my MBP with Godot still running it also doesn't really go to sleep.

I could notice this with the editor on Linux too (with no project running). I wonder if #64100 is actually not fixed in 4.0.2, since there is an editor feature tag override for the Keep Screen On project setting.

Can you reproduce this if you disable Keep Screen On in the advanced Project Settings, then restart the editor?

Can anybody else confirm if this is also caused by the audio system?

Try starting the editor with the --audio-driver Dummy command line argument to check. (Note that this argument is not passed from the project manager to editor, so open a project directly in the editor via command line arguments instead.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.