Jump to content

Emby server gracefully shuts down when playing from iPadOS


beesyrup
Go to solution Solved by beesyrup,

Recommended Posts

beesyrup

Hi,

I've been having a consistent issue over the course of a few weeks,and I wanted to request a log analysis to determine if there is any reason why this is happening.

In short, my Emby server keeps gracefully shutting down for some reason only when I'm playing videos off of my iPad Pro.

Context:
I have an Emby server v4.7.14.0 running on Debian 11 Bullseye. All of the traffic is local. I have an NVidia Shield TV Pro (2017) that is wired in via ethernet running Emby app v2.0.98g. This works 100% without any problems at all.

When I use my iPad (Emby v2.2.15), any time I play a video that's over an hour long, something happens where the video playback fails and I see an error indicating that the server is unavailable. When I check my server, I can see that the Emby service gracefully shutdown. The only way for me to get this back up and running again is to SSH into my local server, and run

service emby-server start

I checked the log files to check for any errors, but the only glaring thing seems to be a "Stopping HttpListener..." along with a 206 response which lasted 1342681ms:

2023-11-18 01:26:09.028 Info Server: Stopping HttpListener...
2023-11-18 01:26:14.054 Info Server: http/1.1 Response 206 to host2. Time: 1342681ms. http://192.168.86.250:8096/emby/videos/101763/stream.mkv?DeviceId=01E48163-DC5C-4380-8F10-5453BBAAEC26&MediaSourceId=ce73d47ec61d3c2a82af0a349ded2412&Static=true&PlaySessionId=c67d1fca5b944aadba356b498fbc8ab0

 

I am attaching the full logs for your review. Any information that could help me troubleshoot this issue (if this is a network or hardware problem) would be appreciated. If this might potentially be unintended behavior in Emby, please let me know if I can provide any additional information.

Thank you in advance!

embyserver-63835867574.txt

Link to comment
Share on other sites

beesyrup

Hey @Luke,

Thanks for your response. Yes, it doesn't happen if I don't play from my iPad. I'm not sure why my Shield TV can take everything it throws at it.

Do you have any suggestions for any system-level diagnostics that might help me investigate this?

Thanks!

Link to comment
Share on other sites

  • 2 weeks later...
beesyrup

Hi @Luke,

Sorry for the lack of responses. I haven't tested it extensively using the latest iPadOS release, but I will. I actually had the same problem while watching a video from my Shield TV Pro settop box: I realize I may have made a gaffe when I was streaming. I copied over a file with the same name while I was watching it. It must have errored out somehow, but still, it gracefully exited.

I've identified a workaround to help emby-server persist by leveraging a simple bash script to check whether emby-server is running, and if not run it:

1. create a script called check-emby.sh
sudo nano check-emby.sh
 
2. insert the following contents
#!/bin/bash
service=emby-server
 
if (( $(ps -ef | grep -v grep | grep $service | wc -l) > 0 ))
then
echo "$service is up"
else
service $service start
fi
 
3. ensure that it is executable
sudo chmod +x check-emby.sh
 
4. modify cron jobs
sudo crontab -e
 
5. append the following entry to have this execute every minute
* * * * * /path/to/check-emby.sh
From a workaround perspective, if emby-server shuts down gracefully for whatever reason, I can have a cron job scheduled to ensure that it is restarted. If not, it just prints that it's running.
 
Might be a bit excessive, but since I don't want to SSH every time that the server goes down and restart it manually, this might pay off for me.
  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...
  • Solution
beesyrup

OK, I figured out the root cause. The good news is that it wasn't Emby.

I use a lightweight distro of Debian that includes some maintenance features OOTB.

The problem was that the backup service was executing daily around 01:00 every evening. I kept trying to nail down the pattern for a while and noticed that several services (samba, homebridge, emby, etc.) were all inaccessible at the same time.

Before the backup service executes, it shuts down all running services prior to moving forward with the backup. The cron job above will be good for redundancy since I do have it scheduled for 04:00 on Tuesdays now, but I figure I'd be asleep by then.

Thanks for engaging with me @Luke.

  • Thanks 1
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...