Howdy all, SABnzbd 0.5.6 on Windows 7 x64...
Using the basic Windows power settings - with "Put the computer to sleep" set to 30 minutes.
It seems SABnzbd isn't stopping Windows from going to sleep - as I've watched go to sleep after 30 minutes of inactivity.
I can't seem to find any threads relating to a recent version of SAB though, most of them are from ~2008.
Thoughts as to where I can look? I couldn't find any settings in SAB itself - assumed the 'stay awake' stuff was built in?
Cheers,
Nick
Windows still going to sleep whilst downloading
Forum rules
Help us help you:
Help us help you:
- Are you using the latest stable version of SABnzbd? Downloads page.
- Tell us what system you run SABnzbd on.
- Adhere to the forum rules.
- Do you experience problems during downloading?
Check your connection in Status and Interface settings window.
Use Test Server in Config > Servers.
We will probably ask you to do a test using only basic settings. - Do you experience problems during repair or unpacking?
Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Re: Windows still going to sleep whilst downloading
Yes it is, although I haven't tested it for ages because the code never changed.TheWedgie wrote: assumed the 'stay awake' stuff was built in?
Basically it does a periodic SetThreadExecutionState(ES_SYSTEM_REQUIRED) system call
while still downloading and postprocessing.
Re: Windows still going to sleep whilst downloading
So, is there or is there not an issue with SAB and Sleep? Curious really but I am wondering about using Sleep as my wife claims she can hear the PC at night (need to club her harder!)
Re: Windows still going to sleep whilst downloading
Do you happen to have individually paused items in your queue?
I suspect that having these will make SABnzbd think the queue isn't really empty,
so it keeps kicking Windows awake.
I must look into that.
BTW: this is the opposite of what "TheWedgie" complained about...
I suspect that having these will make SABnzbd think the queue isn't really empty,
so it keeps kicking Windows awake.
I must look into that.
BTW: this is the opposite of what "TheWedgie" complained about...
Re: Windows still going to sleep whilst downloading
Hi,
First of all, thanks to all the people contributing to the development of sabnzbd. I'm using it for years now and I am super happy with it!
Now my question:
I have recently bought a brand new machine (intel NUC10i7FNK2) with Windows 10 which I use as a download and media center. I have intentionally instructed Windows to put the machine to sleep after 10 minutes of idle time which works fine, in principle. However, the problem that I experience now is that Windows goes to sleep even if sabnzbd is still in the middle of downloading sth. This is quite annoying.
I should mention that I had an older NUC with Windows 7 before which worked flawlessly in this setup for years with sabnzbd. I never experienced this issue during that time.
A thing which came to my mind and which probably makes a difference here is that the new machine has a big and super fast SSD. The files in sabnzbd are downloaded first to a local folder on that SSD and are processed there. Afterwards, everything is shifted to a NAS in my home network. Before, i.e. with the older machine, the files were downloaded directly to a folder on the NAS and processed there which was always rather slow and caused a lot of network traffic. But maybe exactly this network traffic prevented Windows of putting the computer to sleep!?
I would be grateful for any ideas / suggestions. I love sabnzbd and still want to use it!! Thank you very much in advance!
anita
First of all, thanks to all the people contributing to the development of sabnzbd. I'm using it for years now and I am super happy with it!
Now my question:
I have recently bought a brand new machine (intel NUC10i7FNK2) with Windows 10 which I use as a download and media center. I have intentionally instructed Windows to put the machine to sleep after 10 minutes of idle time which works fine, in principle. However, the problem that I experience now is that Windows goes to sleep even if sabnzbd is still in the middle of downloading sth. This is quite annoying.
I should mention that I had an older NUC with Windows 7 before which worked flawlessly in this setup for years with sabnzbd. I never experienced this issue during that time.
A thing which came to my mind and which probably makes a difference here is that the new machine has a big and super fast SSD. The files in sabnzbd are downloaded first to a local folder on that SSD and are processed there. Afterwards, everything is shifted to a NAS in my home network. Before, i.e. with the older machine, the files were downloaded directly to a folder on the NAS and processed there which was always rather slow and caused a lot of network traffic. But maybe exactly this network traffic prevented Windows of putting the computer to sleep!?
I would be grateful for any ideas / suggestions. I love sabnzbd and still want to use it!! Thank you very much in advance!
anita
Re: Windows still going to sleep whilst downloading
I think it may need the ES_CONTINUOUS flag in addition to ES_SYSTEM_REQUIRED.
Re: Windows still going to sleep whilst downloading
@Puzzled: We set the the state every 30 seconds, maybe that's not enough? We can do it every 3 seconds.
From the documentation a periodic call with ES_SYSTEM_REQUIRED should be enough?
https://docs.microsoft.com/en-us/window ... utionstate
From the documentation a periodic call with ES_SYSTEM_REQUIRED should be enough?
https://docs.microsoft.com/en-us/window ... utionstate
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
Re: Windows still going to sleep whilst downloading
Dear Puzzled and safihre,
Thank you very much for answering! After some testing, I think I can now with some confidence claim that I found the solution. The following works robustly at least for my system using Windows 10 Pro:
The 'magic' was given by Puzzled: it indeed needs the ES_CONTINUOUS flag in addition to ES_SYSTEM_REQUIRED. And you only need to call it once, that's completely enough. Setting the state periodically only with ES_SYSTEM_REQUIRED - no matter what's the frequency, like 3 seconds or 30 seconds - doesn't work at all. Actually, when you look at the code snippet on the bottom of the Microsoft website provided by safihre, the above solution is also more or less stated there.
How did I find it out? First of all, I set Windows to a very aggressive power saving mode. I told it to put both the monitor and the computer itself to energy saving mode after 1 minute. Then I used my extremely limited coding capabilities in Python to create the following kind of 'minimal testing script':
Result: After staying awake for 6 minutes (5 due to time.sleep(300) + 1 due to system idle), the computer goes to sleep, as could be expected. By the way, if you remove the ES_DISPLAY_REQUIRED flag above, only the monitor goes to sleep but the computer itself stays awake.
Could anyone of you guys be so nice to confirm this? That would be great! And if yes, would it be possible to modify sabnzbd in the future accordingly?
Thank you very much again and kind regards
anita
Thank you very much for answering! After some testing, I think I can now with some confidence claim that I found the solution. The following works robustly at least for my system using Windows 10 Pro:
The 'magic' was given by Puzzled: it indeed needs the ES_CONTINUOUS flag in addition to ES_SYSTEM_REQUIRED. And you only need to call it once, that's completely enough. Setting the state periodically only with ES_SYSTEM_REQUIRED - no matter what's the frequency, like 3 seconds or 30 seconds - doesn't work at all. Actually, when you look at the code snippet on the bottom of the Microsoft website provided by safihre, the above solution is also more or less stated there.
How did I find it out? First of all, I set Windows to a very aggressive power saving mode. I told it to put both the monitor and the computer itself to energy saving mode after 1 minute. Then I used my extremely limited coding capabilities in Python to create the following kind of 'minimal testing script':
Code: Select all
import ctypes
import time
ES_CONTINUOUS = 0x80000000
ES_SYSTEM_REQUIRED = 0x00000001
ES_DISPLAY_REQUIRED = 0x00000002
ctypes.windll.kernel32.SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED | ES_DISPLAY_REQUIRED)
time.sleep(300)
ctypes.windll.kernel32.SetThreadExecutionState(ES_CONTINUOUS)
Could anyone of you guys be so nice to confirm this? That would be great! And if yes, would it be possible to modify sabnzbd in the future accordingly?
Thank you very much again and kind regards
anita
Re: Windows still going to sleep whilst downloading
Change the code! WIll be in the next release.
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate