Dan_Austin 71 Posted January 26, 2020 Posted January 26, 2020 Or optional pre-empt live TV streams for scheduled recordings. My mother is visiting and managed to exit the Roku Emby app incorrectly a couple of times yesterday. This tied up all three HDHR tuners resulting in six missed scheduled recordings last night. When I realized something was odd the dashboard was only showing one active client using one tuner, and no active recordings, but the HDHR showed all tuners in use by Emby. Restarting Emby released the tuners, so it would be handy if an optional scheduled task could set to release all tuners, or if Emby could detect when tuner streams exist that do not have a client or recording using them..
Happy2Play 9785 Posted January 26, 2020 Posted January 26, 2020 Do you have the "Are You Still Watching?' option enabled in Emby Roku Channel setting?
Dan_Austin 71 Posted January 26, 2020 Author Posted January 26, 2020 I knew that would come up. I don't use it. I frequently leave the TV on for background noise, and really don't want to have to interact with it every few hours to keep it running. And I am not convinced it would help in this case. The Roku was on and actively used to watch live TV, but obviously only one of the streams. The Roku was unaware of the other two streams, so it wouldn't know to check it they were still in use.
ebr 16195 Posted January 27, 2020 Posted January 27, 2020 What you asked for here, I don't think would have solved your issue since, as you said, Emby appeared unaware of the tuner usage. Therefore, I think what your situation really needs is investigation into why the tuners weren't released properly when the client went away. Moving to Server section and please provide logs from when this occurred if possible. Thanks.
Dan_Austin 71 Posted January 27, 2020 Author Posted January 27, 2020 (edited) The why is easy. My mother has not learned the rules of Emby on Roku. She likely just turned the system off or hit exit. I just tested that and have an orphaned tuner. The dashboard shows one active client with one stream, and there are two ffmpeg processes running in the OS (Linux) Roku app version 3.0.206 Server beta 4.4.0.7 Restarting Emby does end the orphaned ffmpeg, but that could just be the OS doing the right thing. I have seen that the clients are supposed to send a heartbeat/keep-alive to the server. I'd like to know more about that process. In my mind that communication would include the session id of the active stream. The server would need a simple state table that tracks stream ids and clients. If there is a stream without a client, or a client that has more than one stream (and cannot support that), kill the stream that has not had a heartbeat update in X(seconds/minutes/update intervals). In the meantime I have a script that will check to see if all tuners are in use, or more accurately three ffmpeg tasks related to a tuner stream, and if there are restart Emby. The check will fire just before midnight. It is crude, but I so far do not have an recordings in that time block and am almost never up watching TV at that time. I also have a shield sitting in my Amazon cart. I haven't decided if I need to ditch the Roku platform. The improvements in the last year have been impressive, but the issues that remain all seem to be of the nature 'That is just how the Roku OS works' Edited January 27, 2020 by Dan_Austin
ebr 16195 Posted January 27, 2020 Posted January 27, 2020 The why is easy. My mother has not learned the rules of Emby on Roku. She likely just turned the system off or hit exit. I just tested that and have an orphaned tuner. The dashboard shows one active client with one stream, and there are two ffmpeg processes running in the OS (Linux) That is not an "orphaned" tuner. That is a client that is still active. What, exactly, did you turn off? It sounds like the Roku app is still running and consuming the stream. If it is a separate box and you just turned off the TV that is what will happen and the only recourse is the "Still Watching" feature but it will take at least an hour for that to take effect. You could also stop the stream from the dashboard manually (stop button) though.
Dan_Austin 71 Posted January 27, 2020 Author Posted January 27, 2020 It is a separate box and definitely not active. I just ran another set of tests. Tuned a channel Hit home exiting the app Tuner still in use and the dashboard shows the client still streaming that channel Re-entered app and tuned a different channel The dashboard immediately shows the new channel being streamed using a 2nd tuner The first tuner is still used, but going nowhere If I use the back button to exit the channel and retune the 1st channel, the server correctly releases the 2nd tuner and re-uses the 1st. Is there a server-side 'still watching' feature in addition to the client-side? I don't see how the Roku app 'still watching' will help if the app is closed. I just enabled the Roku 'still watching' and ran the steps to orphan a tuner. We'll see if it helps. Also noted that once a tuner/stream is abandoned/orphaned/locked the system will allow it to be shared, as in a new session will use the stream, but cleanly exiting that session does not release the tuner. Back in an hour with test results.
ebr 16195 Posted January 27, 2020 Posted January 27, 2020 In your previous report, you did not say you hit "home". You just said you "turned the system off" and that the dashboard still showed the active client. When you hit "home" or remove power from the device, etc. then the server should realize the app is gone but it will take at least 60 seconds for this to occur. Can you please try waiting a minute or two to see if things get cleaned up in that case? Perhaps the issue arises when the app is killed and then streaming is re-started before the system has cleaned up the old stream.
Dan_Austin 71 Posted January 27, 2020 Author Posted January 27, 2020 Perhaps the issue arises when the app is killed and then streaming is re-started before the system has cleaned up the old stream. Sorry I used 'exit' which is mapped to home on my remote. I thought you might be right about not waiting long enough, so I just tested that. The dashboard shows the Roku has not been seen in 5 minutes. I can see the tuners are still in use, according to the HDHR, but the ffmpeg processes are gone. So the server does sort of clean up after an unclean shutdown. And after thinking about it, I shutdown the system on Saturday night and it would have been 3+ hours between the shutdown and the first missed recording, so that should have been enough time. So exiting the app incorrectly does not release the tuner. After re-entering and exiting properly, the tuners are still shown as in use on the HDHR, and the ffmpeg processes are stopped. At this point there is no visible indication that the streams/tuners are in use. The final oddity is that even though there are no indications that Emby is still using the tuners, restarting Emby immediately releases them. Since tuners can be shared I assume there is a reference count attached to a stream, which perhaps does not get updated in the case of an unclean client exit.
Luke 42085 Posted February 3, 2020 Posted February 3, 2020 We'll take a look at that. Thanks for reporting.
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