Jump to content

What is locking all my tuners?


CharlieMurphy

Recommended Posts

CharlieMurphy
On 9/18/2021 at 5:18 PM, cayars said:

The best thing to do is just keep testing 11 and if you find a situation you can reproduce then post in the Server forum in the Testing area with the current server log file.
That will give Luke a chance to review it.

Thanks for helping to test this on 11 beta!

Just an update.

Emby is still having the issue of locked tuners. It's still not just Roku, it's just that I had a reliable way of reproducing the issue with Roku. This is also an issue for HDHR on channels with poor reception. Sometimes the image and sound freeze and don't come back, you back out to the guide and Emby never releases the tuner. This is with Android TV as the client, not Roku. I've found this to be the case with IPTV as well.

My issue with reproducing this with logs, using the Roku, is that whenever I have time to test this I keep running into other bugs that muddy the situation. The latest issue is that Roku makes you re-type credentials to change servers, however, when opening the Roku app/channel it randomly reverted to my other server that it had previously connected to. So now I have to retype my credentials for my test server, is it going to revert again after I restart the server and start over with testing? Probably so. 🤬

So that's where I am. A little frustrated right now but not giving up yet. I am going to try with my faster Roku so I am waiting on it less.

Link to comment
Share on other sites

I've seen that happen as well regardless of client used.  Week signals can be a problem.  Anything less than reliable probably should try to be fixed or removed from the lineup.
Ideally, Emby Server should handle this however.

Luke has made a lot of progress on this but in my mind we still need a cleanup routine to cover all situations and things that still might get passed the code in place.

What is needed is a simple routine that runs on a schedule/loop that looks at the tuners.  If any tuner is internally shown as locked it checks to see if the user/device is still online and sending a beacon showing it's still active else remove the lock and free up the tuner.  Same with the user/device being active but in some other part of the system like streaming a movie or pulling back TV Show Episodes.  In that case it's not a valid lock and should be freed up.  Basically if you know the device is using some other resource other than watching that specific channel it's an invalid lock and needs to be freed up.

That type of simple check would be fast and hardly any impact on the system performance. If no tuners are locked the check is skipped.

  • Like 2
Link to comment
Share on other sites

CharlieMurphy

I will remove the weak OTA channels. I have a nightly restart script that also empties the transcode folder now. Sometimes I still hit the tuner limit though.

Having to restart nightly, which sends active streams back to the guide, is not graceful. It feels like I'm asking my parents to alpha test the live TV function of Emby with me. I may have to ditch the Emby live TV hopes and just get them, and myself on an IPTV client.

Link to comment
Share on other sites

  • 2 weeks later...
sammyk77
On 10/19/2021 at 2:05 PM, CharlieMurphy said:

I will remove the weak OTA channels. I have a nightly restart script that also empties the transcode folder now. Sometimes I still hit the tuner limit though.

Having to restart nightly, which sends active streams back to the guide, is not graceful. It feels like I'm asking my parents to alpha test the live TV function of Emby with me. I may have to ditch the Emby live TV hopes and just get them, and myself on an IPTV client.

 

Would you be willing to share your script? Dealing with the same issues and getting tired of having to do both of these manually. 

Edited by sammyk77
Link to comment
Share on other sites

Groentjuh

I'm also facing the same issue, but in my case it is a Samsung TV running the emby app and TvHeadend plugin providing the TV service.

Just a simple: Tune to a TV channel using the TV Emby app and a tuner will be locked to that channel until Emby get a restart. Tune to another channel and a second tuner is gone. It ends when I either run out of tuners (8), scambling capacity (~4 channels) or bandwidth.

I really hope Emby could implement some kind of clean-up system, which prevents the server from pointlessly staying tuned to a channel. I do not mind that taking a minute to detect it. Live TV in its current form is really next to unusable.

Link to comment
Share on other sites

martincom

For the most part, Emby Live/Recording is now working very well for us and I'm more than pleased with it.

I had moved the temp transcoding folder to a network share, so I could periodically check it and empty it.  After a beta release or two ago, I wasn't finding any old transcode files in the temp folder any longer.  So I moved it back to the default location.  I was doing some maintenance on the server a week ago and I found quite a number of old transcoding files in the temp folder.  The majority of these were from music playback, which occurred after I moved the transcoding temp folder back to the default location.  I have three of the high end Sony A/V receivers and the only way I could make them work with Emby DLNA was if the source servers files are transcoded to MP3.  However, I did note there were also some video files from Emby transcoding 1080i to 1080p---but no where near the amount I would have expected if all the 1080i to 10080p transcoding files were not being deleted.

So, I'd like a copy of your script, also.  I'm sure I could write my own--but why re-invent the wheel.  I have no need for Emby to re-start, as I'm not having exactly the same issues you are.  I could edit the script to "remark" those commands out of it.

I upgraded the processor, on my server, to one a bit faster, and double the cores and quadruple the threads.  That resolved my immediate transcoding issues.  I'm sure there will be instances arrive in the future where it will be be an issue when multiple recorded and live 480/1080i broadcasts are being played simultaneously.  That would be a rare occurrence, so we have no issue waiting for the feature add that will allow transcoding of interlaced files to be disabled.

Link to comment
Share on other sites

martincom
3 hours ago, Groentjuh said:

I'm also facing the same issue, but in my case it is a Samsung TV running the emby app and TvHeadend plugin providing the TV service.

Just a simple: Tune to a TV channel using the TV Emby app and a tuner will be locked to that channel until Emby get a restart. Tune to another channel and a second tuner is gone. It ends when I either run out of tuners (8), scambling capacity (~4 channels) or bandwidth.

I really hope Emby could implement some kind of clean-up system, which prevents the server from pointlessly staying tuned to a channel. I do not mind that taking a minute to detect it. Live TV in its current form is really next to unusable.

Within the Emby user\playback settings:

1. Uncheck the "Play next episode automatically."

2. Check the "Enable 'Are You Still Watching?' prompt"

See if that resolves your issue.

312874307_Embyplaybacksettings.thumb.JPG.456dba160d400ea2894c542fb5237a3e.JPG

Link to comment
Share on other sites

CharlieMurphy

I use Docker, y'all. It's just a simple shell script that pulls new Docker images first, then stops and removes the containers, deletes contents of temp folders, and remakes the containers. Happy to post it if any of you use Docker too, I use the Linuxserver.io images but you can change it to the Emby official easily. My transcode folder likely isn't going to be in the same place, etc.

1 hour ago, martincom said:

Within the Emby user\playback settings:

1. Uncheck the "Play next episode automatically."

2. Check the "Enable 'Are You Still Watching?' prompt"

Don't these setting just change the web app? Within Android TV and Samsung these setting also exist and they seem to be per-device. I don't think this will help at all unless the server itself enforces these settings. I can have these settings, unplug my Android TV device and set it on fire, Emby server will still keep that stream open and nothing will be in the dashboard.

Link to comment
Share on other sites

CharlieMurphy
#!/bin/sh
docker pull dnsforge/xteve:latest
docker pull linuxserver/emby
docker stop emby
docker stop xteve
docker rm emby
docker rm xteve
rm -R /home/user/transcode/emby/*
rm -R /home/user/transcode/xteve/*
#Emby
docker run -d \
  --name=emby \
  --net=mynet \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=America/New_York \
  -p 8096:8096 \
  -p 8920:8920 \
  -v /home/user/emby:/config \
  -v /home/user/movies:/mnt/movies \
  -v /home/user/recordings:/mnt/recordings \
  -v /home/user/shows:/mnt/shows \
  -v /home/user/transcode/emby:/mnt/transcode \
  --restart unless-stopped \
  linuxserver/emby
#XTeVe
docker run -it -d --name=xteve \
  --restart=unless-stopped \
  --net=mynet \
  -v /home/user/xteve/conf:/home/xteve/conf \
  -v /home/user/transcode/xteve:/tmp/xteve \
  -e TZ=America/New_York \
  dnsforge/xteve:latest
docker start xteve
docker start emby
docker image prune -f -a
date >> ~/embyrestart.txt
exit 0

First off, I have no idea what I'm doing so that's a disclaimer.

I named it 'embyrestart.sh'

Set a cronjob to run it:

$ crontab -e

add this line:

30 03 * * * bash /home/user/embyrestart.sh

This runs it at 3:30am. Plan this around guide refreshes and Emby's scheduled tasks, I wouldn't want to restart in the middle of a guide refresh every night.

Edited by CharlieMurphy
Link to comment
Share on other sites

That seems like a hard way to go about cleaning the transcode folder. :)

Let me ask this of you guys with this problem.

Would cleaning/removing any file in the transcode folder older than 1 day work?

 

Link to comment
Share on other sites

rbjtech

For Windows users - there is a nifty built in command called 'forfiles' which takes file age parameters - so you can use it to remove files of a certain age - perfect for temp files or recording files that you may need to keep around until you have processed them or whatever.

Put the commands below in a .bat file - add it into the Windows Task Scheduler to run everyday (just type 'schedule' in the search box..).

Obviously change the path to where your temp files are and the -10 to how ever many days you want to retain.

Every day it will delete the both the files and subfolders older than 10 days... :)

forfiles /P "M:\DownloadTemp\RecycleBin" /S /D -10 /M * /C "cmd /c if @isdir==FALSE del @path"
forfiles /P "M:\DownloadTemp\RecycleBin" /S /D -10 /M * /C "cmd /c if @isdir==TRUE rd @path"

 

  • Like 1
Link to comment
Share on other sites

CharlieMurphy
6 minutes ago, cayars said:

That seems like a hard way to go about cleaning the transcode folder. :)

Let me ask this of you guys with this problem.

Would cleaning/removing any file in the transcode folder older than 1 day work?

 

No, this is not to clear the transcode folder at all. This script and thread is about freeing up tuners that are locked by Emby with nobody watching and nothing in the dashboard.

Link to comment
Share on other sites

rbjtech
1 minute ago, CharlieMurphy said:

No, this is not to clear the transcode folder at all. This script and thread is about freeing up tuners that are locked by Emby with nobody watching and nothing in the dashboard.

So are you saying that if you restart emby and restart the HDHR - the tuners are still locked ?  It needs an actual os/docker reboot to clear them ?

Link to comment
Share on other sites

CharlieMurphy

 

6 minutes ago, rbjtech said:

For Windows users - there is a nifty built in command called 'forfiles' which takes file age parameters - so you can use it to remove files of a certain age - perfect for temp files or recording files that you may need to keep around until you have processed them or whatever.

Put the commands below in a .bat file - add it into the Windows Task Scheduler to run everyday (just type 'schedule' in the search box..).

Obviously change the path to where your temp files are and the -10 to how ever many days you want to retain.

Every day it will delete the both the files and subfolders older than 10 days... :)

forfiles /P "M:\DownloadTemp\RecycleBin" /S /D -10 /M * /C "cmd /c if @isdir==FALSE del @path"
forfiles /P "M:\DownloadTemp\RecycleBin" /S /D -10 /M * /C "cmd /c if @isdir==TRUE rd @path"

 

Somewhere ya'll got lost in this thread and that's understandable. The issue is Emby not releasing tuners after a user stops streaming or when a stream fails. Transcode folder filling is a side effect of that so when clean up the transcode folder as we restart Emby server to release it's death grip on the tuners.

Link to comment
Share on other sites

6 hours ago, Groentjuh said:

I'm also facing the same issue, but in my case it is a Samsung TV running the emby app and TvHeadend plugin providing the TV service.

Just a simple: Tune to a TV channel using the TV Emby app and a tuner will be locked to that channel until Emby get a restart. Tune to another channel and a second tuner is gone. It ends when I either run out of tuners (8), scambling capacity (~4 channels) or bandwidth.

I really hope Emby could implement some kind of clean-up system, which prevents the server from pointlessly staying tuned to a channel. I do not mind that taking a minute to detect it. Live TV in its current form is really next to unusable.

This sounds like a configuration issue if I'm reading this correct.  What you're saying is basically any time Emby touches a tuner it is never freed up correct?

Are you using m3u with Emby or the TVH plugin?

Link to comment
Share on other sites

CharlieMurphy
3 minutes ago, rbjtech said:

So are you saying that if you restart emby and restart the HDHR - the tuners are still locked ?  It needs an actual os/docker reboot to clear them ?

No need to reboot HDHR, just Emby. My script doesn't reboot the OS/docker. "docker restart emby" would suffice. If you are going to restart a container, you might as well pull the latest image first and remake it. If you don't use Docker, just restart Emby.

Edited by CharlieMurphy
Link to comment
Share on other sites

rbjtech
1 minute ago, CharlieMurphy said:

 

Somewhere ya'll got lost in this thread and that's understandable. The issue is Emby not releasing tuners after a user stops streaming or when a stream fails. Transcode folder filling is a side effect of that so when clean up the transcode folder as we restart Emby server to release it's death grip on the tuners.

ok sure - and I've witnessed that myself numerous times - but a hdhr soft reset have never failed to release the tuners.  So I'm wondering why (if) you need to rebuild the docker - I'm just curious - if that works for you then go for it :)

Link to comment
Share on other sites

2 minutes ago, CharlieMurphy said:

 

Somewhere ya'll got lost in this thread and that's understandable. The issue is Emby not releasing tuners after a user stops streaming or when a stream fails. Transcode folder filling is a side effect of that so when clean up the transcode folder as we restart Emby server to release it's death grip on the tuners.

What kind of tuners are you using? Any plugins involved?

Link to comment
Share on other sites

CharlieMurphy

It's a Docker thing. Containers are disposable and updating it takes the same amount of time as restarting it.

Link to comment
Share on other sites

CharlieMurphy
Just now, cayars said:

What kind of tuners are you using? Any plugins involved?

This happens regardless of the tuner. m3u direct, m3u through xTeVe, and now that I have an HDHR, that too. It happens on both my servers and everyone here seems to have experienced and acknowledged it.

Link to comment
Share on other sites

CharlieMurphy
3 minutes ago, rbjtech said:

 but a hdhr soft reset have never failed to release the tuners.

resetting the HDHR will free the tuners on the HDHR. In my experience, Emby will still hold the transcode files and a "Simultaneous stream limit:" slot. Restarting Emby is the right move because it releases the HDHR tuner(s) and also allows Emby to align with reality.

Link to comment
Share on other sites

CharlieMurphy

To recreate,

1. make a TV source that has only 1 allowed stream.

2. Use a Roku to stream from that source.

Eventually, the only way to stream will be an Emby restart. If you wish to make this happen really fast, use the home key on the Roku while  live stream from that source is playing. This also happens outside of Roku clients, it's just that Roku fast tracks the issue and has an easy way to force it.

Keep in mind that once the tuner is locked without a client, you can still watch the channel it is locked into because it doesn't use a "Simultaneous stream limit:" slot.

Edited by CharlieMurphy
Link to comment
Share on other sites

CharlieMurphy

Just to add one more thing because this thread went so many directions. Cleaning up orphaned transcode files would be a nice feature for Emby but it's not urgent at all. The locking of the tuners, that we all acknowledge happens, is very urgent for the live TV feature in Emby in my opinion. It's making me explore less desirable alternatives and I couldn't recommend Emby for live TV because of it.

Link to comment
Share on other sites

CharlieMurphy
1 hour ago, rbjtech said:

ok sure - and I've witnessed that myself numerous times - but a hdhr soft reset have never failed to release the tuners.  So I'm wondering why (if) you need to rebuild the docker - I'm just curious - if that works for you then go for it :)

Sorry for the string of posts but I have more to explain why this isn't a reasonable solution in some cases. The live TV function is intended to take your TV remotely so resetting an HDHR is not always going to be an option. Suppose this exact thing happens on an m3u and not an HDHR, there's no soft reboot for an m3u, that slot is locked to that channel until Emby restarts. It can be just Emby/Emby container and that's not a huge deal. The cleanest way I've found to run Emby is to restart it nightly. If I have to restart I'm going to clean the transcode folder and pull new images. If someone is watching a stream that early they get dumped to the guide and that's not desirable. Tuners can technically still be locked for over 23 hours if you use this method. I'm not using my Roku with Emby at all anymore, even with the restarting.

Also of note, I pull images and remake my Plex container exactly like this to update it. There can be at least 5 streams (not live) playing and they won't see an interruption because the container is remade with the new image, started, and reestablished with the devices before they run out of buffer. That's just to say that remaking a container isn't much more timely than restarting a service, so you might as well use an updated image... I think.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...