RP Service prevents system sleep after streaming

Spotted something that's not working as you think it should? Post bug reports in here and read about the known issues.
Forum rules
No spamming, flaming, or abuse - play nicely!

RP Service prevents system sleep after streaming

Postby NielsR » Wed Jun 15, 2011 1:05 pm

Hi RP Developers.

Thank you for a great product, I really like it, but have a problem I really really would like you to look at.

My HTPC runs perfectly with RP installed (Newest version), everyhting works fine, it goes into sleep automatically after a recording etc. Only when I does a streaming af a video to any remote device (Web browser, phone), the HTPC does not go into sleep/hibernation anymore.

I have done an analyse of the system, and it tells me it is the RP Service that is preventing sleep/hibernation.
If I then restart the RP Service, everything work perfectly again until I stream any video again.

I have enabled logging on the RP Service, and I can see a log entry that the system knows nothing is streaming anymore, and it will enable the system for hibernation/sleep again, but it does not actually seem to do it.

So please if you have the time, revisit the code and check kthat you actually call the Windows API correctly for the "Allow hibernation/sleep" step again. Since everything points to the the RP Service is not actually doing it correctly.
NielsR
New Potato
 
Posts: 4
Joined: Fri Feb 11, 2011 3:31 pm

Re: RP Service prevents system sleep after streaming

Postby Carlos » Wed Jun 15, 2011 1:58 pm

HI Niels

Thanks for the comprehensive post. I'll take a look at this. I wonder if it's to do with what the permissions of the account under which your service is running. Is it a full administrator user?

Carlos
___________________________________________________
Carlos P - Lead Developer
Download | FAQ: Support iOS App

FAQ: How to post debug logs | How to clear your browser cache

If you've found Remote Potato useful, please consider buying me a pint. Much appreciated!
User avatar
Carlos
Head Potato
 
Posts: 1505
Joined: Thu Mar 04, 2010 8:48 pm
Location: London, UK

Re: RP Service prevents system sleep after streaming

Postby NielsR » Wed Jun 15, 2011 6:16 pm

Hi Carlos!

Thanks for quick answer.

Yes, the user is Administrator on the HTPC, UAC is enabled, I believe a service under that account is running elevated.
NielsR
New Potato
 
Posts: 4
Joined: Fri Feb 11, 2011 3:31 pm

Re: RP Service prevents system sleep after streaming

Postby Carlos » Sun Jun 19, 2011 7:45 pm

Niels

You sound like you may know a little about the Windows API, so I thought I would post the code here that I use to prevent / re-enable standby. Please let me know if you can see any inconsistencies:


Code: Select all
        public static void PreventStandby()
        {
             SetThreadExecutionState(EXECUTION_STATE.ES_SYSTEM_REQUIRED |
                                EXECUTION_STATE.ES_CONTINUOUS);
        }
        public static void AllowStandby()
        {
            SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS);
        }


[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE esFlags);
       
        [FlagsAttribute]
        public enum EXECUTION_STATE : uint
        {
            ES_SYSTEM_REQUIRED = 0x00000001,
            ES_DISPLAY_REQUIRED = 0x00000002,
            ES_CONTINUOUS = 0x80000000,
        }
___________________________________________________
Carlos P - Lead Developer
Download | FAQ: Support iOS App

FAQ: How to post debug logs | How to clear your browser cache

If you've found Remote Potato useful, please consider buying me a pint. Much appreciated!
User avatar
Carlos
Head Potato
 
Posts: 1505
Joined: Thu Mar 04, 2010 8:48 pm
Location: London, UK

Re: RP Service prevents system sleep after streaming

Postby Bossworld » Mon Jun 20, 2011 7:18 pm

Funnily enough I've got something of both a similar and a completely opposite problem.

If I WOL the HTPC from my iPhone (just to add something to the guide for example), the media centre returns to sleep after its normal timeout - never shows up on powercfg -requests.

If I WOL the HTPC from my iphone, then stream to the iphone it prevents idling to sleep (checked via powercfg -requests - remote potato is listed as a system SERVICE entry)

If I WOL the HTPC, then use the web interface on a PC, after half an hour (I believe this is slightly longer than my standard timeout) the HTPC goes back to sleep while I'm still streaming. Completely f****d my work PC up earlier due to silverlight, couldn't even end firefox via ctrl_alt_delete.

I assume the iphone code makes it wake because it's never received a signal to say it's finished watching (will test again). But I thought the web interface behaviour was strange, as if you run the powercfg -request at the start of streaming you can see remote potato listed, whereas after a couple of mins it's no longer visible, and presumably starts the sleep timeout.

Hope that helps

-----

EDIT: further testing:

iPhone - streaming divx through the 'my videos' option. Shows in powercfg while playing, then removes itself
iPhone - streaming recorded tv - shows in powercfg then removes itself once finished or 'Done' is pressed.

However:
iPhone - if streaming doesn't start (sometimes happens if choosing too high a quality setting) it gets stuck on powercfg and doesn't remove itself.
iPhone - if streaming is playing then the home button is pressed, it doesn't get removed from powercfg (possibly limited to IOS4's multitasking)

---

streaming through a PC browser - powercfg request is removed within a minute of starting (when watching through silverlight). however this seems inconsistent, tried again and has stayed on the list 2 times after this (perhaps only a bug when watching the first video streamed after wake?) Removes itself if the time slider is moved or upon returning to the menu, or pressing finish at the end of uninterrupted streaming.
Bossworld
Raw Potato
 
Posts: 3
Joined: Mon Jun 20, 2011 7:14 pm

Re: RP Service prevents system sleep after streaming

Postby Carlos » Tue Jun 21, 2011 1:38 pm

Very helpful testing, thanks. I can see it might require some more testing.

I think there might also be thread-related issues too. 'Classic' streaming (to a WP7 phone or the HTML skin, or the Silverlight skin when selecting 'classic' streaming) uses different code, and if this crashes, I want to examine whether the resulting thread is hung and prevents re-enabling standby.

C
___________________________________________________
Carlos P - Lead Developer
Download | FAQ: Support iOS App

FAQ: How to post debug logs | How to clear your browser cache

If you've found Remote Potato useful, please consider buying me a pint. Much appreciated!
User avatar
Carlos
Head Potato
 
Posts: 1505
Joined: Thu Mar 04, 2010 8:48 pm
Location: London, UK

Re: RP Service prevents system sleep after streaming

Postby Carlos » Wed Jun 22, 2011 9:08 am

FYI there are two types of streaming within remote potato, 'classic' and 'silverlive'. They are currently used as follows:

Silverlight Interface: SILVERLIVE (default) & CLASSIC (optional)
HTML interface: CLASSIC
iOS App: SILVERLIVE
Windows Phone 7 Apps: CLASSIC (at time of writing)
Android App: SILVERLIVE


C
___________________________________________________
Carlos P - Lead Developer
Download | FAQ: Support iOS App

FAQ: How to post debug logs | How to clear your browser cache

If you've found Remote Potato useful, please consider buying me a pint. Much appreciated!
User avatar
Carlos
Head Potato
 
Posts: 1505
Joined: Thu Mar 04, 2010 8:48 pm
Location: London, UK

Re: RP Service prevents system sleep after streaming

Postby NielsR » Wed Jun 22, 2011 9:31 am

Hi Carlos!

The code is correct, there is nothing wrong there.

I have also conducted some tests, and as "Bossworld" also has seen, I sometimes get RP to clear the "do not suspend" flag, and sometimes not.
But I have not been able to find any method yet, to reproduce it again and again.

I will get back if I find a way to reproduce the error.
NielsR
New Potato
 
Posts: 4
Joined: Fri Feb 11, 2011 3:31 pm

Re: RP Service prevents system sleep after streaming

Postby kreg37 » Tue Jul 19, 2011 1:08 am

Hi, I've noticed that my HTPC is no longer sleeping... and I suspect it is the most recent Remote Potato update. I've been using Remote Potato for several months and never had issues with the computer sleeping before. Restarting the computer has not solved the issue.

I really don't want my computer running 24x7, so I'm wondering if there is a solution to fix this, or are you working to address this issue? I can't just shut down the computer because I do want it to wake when a recording starts. Thanks.
kreg37
Raw Potato
 
Posts: 1
Joined: Tue Jul 19, 2011 1:03 am

Re: RP Service prevents system sleep after streaming

Postby haggis663 » Thu Jul 21, 2011 11:21 pm

I also have the issue of the system not going into standby due to the RemotePotato service. This occured after using streaming on Android (non Silverlight) and having an issue or 2 with vplayer FCing on startup. It might have something to do with the stream never getting properly established.
haggis663
Raw Potato
 
Posts: 2
Joined: Thu Jul 21, 2011 11:16 pm

Next

Return to Support - Bugs

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron