Letting the server machine sleep (macOS)

i didn’t get a chance to test the longevity of the wake - i’ll have to do that later this afternoon…

rob

I set my Mac Mini to sleep after 1 minute today and did a bunch of testing.

There’s a couple bugs and timeouts in the tvOS app that need to be fixed, but after that it works pretty seamlessly. The mac boots up as soon as you try to use the app and stays alive as long as you’re using it.

cool - i just got back but it sounds like you have it covered. are you going to put the fixes into the testflight beta or will it just appear in an app store update of the channels app?

thanks

rob

I’ve just put out a new tvOS beta with the aforementioned fixes, and submitted it to the App Store as well. Not sure if it will get approved over the weekend or on Monday.

alright, if i can get the TV back from the family i’ll install the beta. thanks for getting this working!

The macOS bonjour and other backend DVR changes are now released to everyone as part of v2017.04.28.2317

New App Store build is also live.

ok, i loaded it. observations:

right after updating the twos app, i put the server machine to sleep
i then went into the tvos app and it went straight to the “setup” page. it did not wake the server.
i exited the app and went straight back in
i was then greeted by the “Loading…” flower for maybe a minute. the server woke.
however, when the app finally left the “loading” page, the DVR was not there.
exiting the app and going back in, the DVR was found.

it could be that my system has an abnormally long delay because the recording directory is on an external USB3 disk…

rob

Hmm I’m also using a pretty slow USB drive and it seemed to work for me. The drive is only touched when you play a recording, not when loading the app.

You could try running this from another computer and seeing how long it takes to get a response when your DVR is asleep:

time curl http://x.x.x.x:8089/status

The tvOS app waits up to 30 seconds

the drive is definitely waking up as the machine wakes. i seem to remember something about older versions of OSX having fewer queues/funnels for IO, so my thinking was that the kernel itself might be blocked waiting for the disk to spin up on wake. this is 10.9.5 so a few versions old.

i’ll time the webserver as you suggest, that should say whether or not the machine is completely blocked until the disk spins up.

rob

Cool. Probably worth upgrading anyway… I’m on 10.11 FWIW

yep, looks like it takes > 30 seconds to actually wake all the way up.

laptop:~ pfile$ time curl http://172.18.1.15:8089/status
curl: (7) Failed to connect to 172.18.1.15 port 8089: Operation timed out

real	0m27.966s
user	0m0.005s
sys	0m0.005s

laptop:~ pfile$ time curl http://172.18.1.15:8089/status
{"arch":"x86_64","description":"the daemon powering Channels DVR","features":    
{"bonjour":true,"comskip":true,"cpu":true,"dvr":true,"guide":true,"nat":false},"name":"channels-dvr","os":"darwin","start_time":"2017-04-28T17:39:40.502593377-07:00","subscription":"active","url":"https://getchannels.com/dvr","version":"2017.04.28.2317"}

real	0m0.293s
user	0m0.006s
sys	0m0.005s

edit: let me do this again forcing curl to wait 60s and see what the actual time is.

Hmm, that's unexpected. The default curl connect timeout is 5 minutes:

https://curl.haxx.se/libcurl/c/CURLOPT_CONNECTTIMEOUT.html
https://askubuntu.com/questions/526226/what-is-the-default-timeout-value-for-curl-when-used-as-command-on-terminal

maybe apple compiled curl with a low timeout?

laptop:~ time curl --connect-timeout 120 http://172.18.1.15:8089/status
{"arch":"x86_64","description":"the daemon powering Channels DVR","features":{"bonjour":true,"comskip":true,"cpu":true,"dvr":true,"guide":true,"nat":false},"name":"channels-dvr","os":"darwin","start_time":"2017-04-28T17:39:40.502593377-07:00","subscription":"active","url":"https://getchannels.com/dvr","version":"2017.04.28.2317"}

real	0m35.711s
user	0m0.006s
sys     0m0.006s

rob

Could I convince you to upgrade macOS to see if it improves wake-up times? I would prefer not the raise the timeout further if at all possible.

sure, i will upgrade. just have to schedule the downtime and/or move tv recording duties to another machine temporarily.

is it worth upgrading to 10.10 instead of .11 or .12 to get another data point? or are you not supporting 10.10?

rob

Up to you. We compile everything with MACOSX_DEPLOYMENT_TARGET=10.10, so Yosemite is officially supported (and technically 10.9 is not).

ok maybe i’ll go to 10.11, we’ll see. i have the ssd, just need to make the plan…