emg456 3 Posted September 1, 2020 Author Share Posted September 1, 2020 Did the same thing today PC woke up at the correct time for a recording. Emby was live and logging at the time but no mention of timers in the logs till I woke it up again manually much later and it fired the timer. Of course, program had already ended. Link to comment Share on other sites More sharing options...
Carlo 4330 Posted September 1, 2020 Share Posted September 1, 2020 I believe the issue is that there is a mismatch in the scheduler and what is "real-time". On wake the scheduler is behind by the same amount of time the computer was sleeping. So if your computer slept for 2.2 hours everything will be off by 2.2 hours until it rights itself. That is my thought at least from minimal investigation I've just started doing on this. Does this sound about right to you from what you see? I'm still early in testing! Link to comment Share on other sites More sharing options...
Carlo 4330 Posted September 1, 2020 Share Posted September 1, 2020 PS This is likely only for Windows from my investigation thus far. Link to comment Share on other sites More sharing options...
emg456 3 Posted September 2, 2020 Author Share Posted September 2, 2020 21 hours ago, cayars said: I believe the issue is that there is a mismatch in the scheduler and what is "real-time". On wake the scheduler is behind by the same amount of time the computer was sleeping. So if your computer slept for 2.2 hours everything will be off by 2.2 hours until it rights itself. That is my thought at least from minimal investigation I've just started doing on this. Does this sound about right to you from what you see? I'm still early in testing! Yes, it looks likely that this may be the case. I'm no programmer but it looks as though when a recording is scheduled, Emby calculates the amount of time to elapse before the timer is due rather than setting an absolute target time? When the computer sleeps. that "internal" Emby timer is not decremented so it becomes later by the amount of time the computer has been asleep. I'm not sure if Emby is aware that the computer has been sleeping or is notified when it re-awakens. I also don't know how often or under what circumstances it checks in with the real time clock to maintain it's timings. Suspect the answer to this may lie there somewhere. Also the fact that the computer can wake from an Emby generated scheduled task and then idle itself back to sleep again without Emby making any entries in the server log during that time suggests that Emby maybe does not recognise that it is still running until there is some user input to it? Tomorrow I will try two timers - on I will let the computer wake up unattended and the other I will interact with Emby as soon as the computer has woken and we'll see if that makes any difference. 1 Link to comment Share on other sites More sharing options...
emg456 3 Posted September 7, 2020 Author Share Posted September 7, 2020 @cayars I have done another test. This one involved quite a few different sleep/wake cycles before the timer fired late. The original timer on creation was for 429.8896677 minutes. this equated to 21:00 on the 6th Sept. There were a few different sleep cycles before the timer eventually fired at 13:38:39 on the 7th Sept. In total between the timer being created and it firing, the computer was awake for 2:50:33 and was asleep for 20:57:57 The original timer length was 07:09:53 so the timing discrepancy does not in this case simply relate to the actual total length of time the computer was awake. Sorry to add complication but it seems that at some point Emby has checked and finds that it should be firing the timer. the delay is possibly controlled by when and under what circumstances Emby checks its timers? Link to comment Share on other sites More sharing options...
emg456 3 Posted September 7, 2020 Author Share Posted September 7, 2020 On 9/2/2020 at 9:27 PM, emg456 said: Tomorrow I will try two timers - on I will let the computer wake up unattended and the other I will interact with Emby as soon as the computer has woken and we'll see if that makes any difference. By the way, the two timers I mentioned in the above post both fired and recorded without issue - that's why I'm late coming back to you! Link to comment Share on other sites More sharing options...
Carlo 4330 Posted September 7, 2020 Share Posted September 7, 2020 Yes, I think it depends on the schedule of when those would fire off or what processes run after waking before they fire off. Regardless it would be best if they were set for specific times not seconds since some event. Link to comment Share on other sites More sharing options...
emg456 3 Posted September 8, 2020 Author Share Posted September 8, 2020 Yes, since the scheduled task does reliably wake the computer with a buffer of about 5 minutes before recording is due to commence, there should be ample time for Emby to adjust to the system clock update which happens as soon as the computer wakes. Link to comment Share on other sites More sharing options...
saturnaqua 4 Posted September 9, 2020 Share Posted September 9, 2020 On 07/09/2020 at 17:52, emg456 said: Sorry to add complication but it seems that at some point Emby has checked and finds that it should be firing the timer. the delay is possibly controlled by when and under what circumstances Emby checks its timers? If you look at the logs, you might seem some events trigger it recalculating the timer delay. For instance, the scheduled task to refresh the EPG (once every 24 hours) seems to kick off a recalculation. There are probably others (ie, restarting Emby, possibly some other scheduled tasks). One of these may have kicked off before Sep 6 21:00 elapsed, recalculated a smaller timer value and went back to sleep and then it was awake on Sep 7 and the timer kept counting down and fired at 13:38. Link to comment Share on other sites More sharing options...
emg456 3 Posted September 9, 2020 Author Share Posted September 9, 2020 I'll have a look tomorrow - at least one of those wakes was caused by an Emby wake to record task which ran for the second time 24 hours after its correctly scheduled time. Link to comment Share on other sites More sharing options...
Luke 37113 Posted September 10, 2020 Share Posted September 10, 2020 On 8/31/2020 at 9:28 AM, emg456 said: @Luke OK Set it up again on Sunday- uninstall/reinstall. Set Hauppauge tuner as Live TV source and Emby Guide Data for the guide. Extra debug logging seemed to prevent the machine from going to sleep so put it to sleep manually.(Power/ Shutdown or sign out/sleep) This morning woke the machine and set a couple of timers - one for 12:00pm - Air Warriors, and one for 12:15pm - Politics Scotland. Put the machine to sleep again at 08:40. Machine woke itself correctly at 11:54:30 to record Air Warriors. No recording was made. Machine was still awake at 12:15 for Politics Scotland but no recording was made. Machine put itself to sleep again at 12:24:51 - unattended system idle timeout is set for 30 mins. I woke the machine manually at 13:10:38 and it tried to fire the timer for Air Warriors at 13:10:40 but program was already finished. It then fired the timer for Politics Scotland at 13:12:30. that program was still running and showed in the Emby browser as in process of being recorded but all that was left was a 23mb .ts file which won't play. I have attached the Embyserver.txt log file and also a wee excel spreadsheet which shows the relevant timings for sleep/ wake and the program timers. If you need any other logs, please shout out before they get overwritten. Thanks Ed embyserver (4).txt 721.36 kB · 1 download emby server sleep issues.xlsx 9.43 kB · 0 downloads The problem is potentially in the .net core runtime. If you look at the log you see entries like this: SystemEvents: SystemEvents_PowerModeChanged Suspend SystemEvents: SystemEvents_PowerModeChanged Resume But there is no resume entry for 11:54, which means emby server is never notified of the wake event. Interestingly though there is a resume entry at 13:10. Was there any difference between those two wake events? Link to comment Share on other sites More sharing options...
emg456 3 Posted September 14, 2020 Author Share Posted September 14, 2020 On 9/10/2020 at 11:30 PM, Luke said: The problem is potentially in the .net core runtime. If you look at the log you see entries like this: SystemEvents: SystemEvents_PowerModeChanged Suspend SystemEvents: SystemEvents_PowerModeChanged Resume But there is no resume entry for 11:54, which means emby server is never notified of the wake event. Interestingly though there is a resume entry at 13:10. Was there any difference between those two wake events? @Luke the 11:54 entry was an Emby task "Wake Source: Timer - Windows will execute 'NT TASK\Emby Recording Air Warriors Mon, 31 Aug 2020 12 00 00 GMT' scheduled task that requested waking the computer." 13:10 was me pushing the power button. "Wake Source: Power Button" Link to comment Share on other sites More sharing options...
emg456 3 Posted September 17, 2020 Author Share Posted September 17, 2020 You're onto something here @Luke Another recording failed although the computer did wake up to record. Gap in the embyserver.txt log entries. First entry *after* the wake up was the emby server "SystemEvents_PowerModeChanged Suspend" entry. This mirrors Windows behaviour in the event logs where the "System is entering sleep" entry is always the first entry *after the computer next wakes up.* In the Windows logs, it is always immediately followed by a "System resumed from sleep" entry but again this time in the Embyserver log, the "SystemEvents_PowerModeChanged Resume" entry is missing. When I woke it up with the power button this morning, the "SystemEvents_PowerModeChanged Resume" entry is present in the Embyserver.txt log. Link to comment Share on other sites More sharing options...
Luke 37113 Posted December 6, 2020 Share Posted December 6, 2020 Are you still having an issue with this? Link to comment Share on other sites More sharing options...
emg456 3 Posted December 7, 2020 Author Share Posted December 7, 2020 Yep - gave up again and resorted to letting NextPVR handle the recordings. I don't know the methodology involved but NPVR never seems to miss a beat on this. I can set up for logging again if you'd like to investigate- I know that this is at the moment a minority interest although as we move forward I suspect that more people will be interested in as much energy saving as they can. Let me know if you want to have another go at it. Link to comment Share on other sites More sharing options...
jkramer 10 Posted December 7, 2020 Share Posted December 7, 2020 Didn't re-read the entire thread... but did at one time. I fixed my wake-timer issues 100% by setting the power setting for the monitor to always on. Link to comment Share on other sites More sharing options...
emg456 3 Posted December 7, 2020 Author Share Posted December 7, 2020 8 hours ago, jkramer said: Didn't re-read the entire thread... but did at one time. I fixed my wake-timer issues 100% by setting the power setting for the monitor to always on. Interesting - I thought I had tried this but on checking, it was not currently set si I have re-set it and will test again now. Thanks. Link to comment Share on other sites More sharing options...
jkramer 10 Posted December 7, 2020 Share Posted December 7, 2020 44 minutes ago, emg456 said: Interesting - I thought I had tried this but on checking, it was not currently set si I have re-set it and will test again now. Thanks. It's weird if you ask me, but it works here. Link to comment Share on other sites More sharing options...
emg456 3 Posted December 8, 2020 Author Share Posted December 8, 2020 Well- that didn't make any difference. My computer sleep time is set to be a lot more stringent than yours- just 15 minutes but I doubt that would make any difference. Link to comment Share on other sites More sharing options...
jkramer 10 Posted December 8, 2020 Share Posted December 8, 2020 Keeping the monitor set at staying on forever is what made it work for me. Nothing to do with the sleep time of the computer. Link to comment Share on other sites More sharing options...
jkramer 10 Posted December 11, 2020 Share Posted December 11, 2020 I forgot to mention, my wake timers used to fire at 5 minutes before the recording, but the PC would go back to sleep before the 5 minutes were up. There is a registry hack you can google to create this Power Setting to remedy that by setting it to 10 or 12 minutes instead of the default 2. It's highlighted in the screenshot. Link to comment Share on other sites More sharing options...
emg456 3 Posted December 13, 2020 Author Share Posted December 13, 2020 On 11/12/2020 at 19:12, jkramer said: I forgot to mention, my wake timers used to fire at 5 minutes before the recording, but the PC would go back to sleep before the 5 minutes were up. There is a registry hack you can google to create this Power Setting to remedy that by setting it to 10 or 12 minutes instead of the default 2. It's highlighted in the screenshot. Thanks but unfortunately the unattended sleep issue has already been addressed so it's not that. Link to comment Share on other sites More sharing options...
jkramer 10 Posted December 14, 2020 Share Posted December 14, 2020 Curious about the setting to never let the monitor sleep... is this specific to using Emby wake-timers or is this a general Win10 known issue? I've kept my server box on Win10 version 1902 because I'm afraid I'll break stuff like this by upping to 2004 or 20H2. This question is directed toward a dev, mainly. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now