Jellyfin Jail Networking Flakiness (and workaround)

dmayle

Cadet
Joined
Mar 15, 2023
Messages
3
I just recently tried to get Jellyfin installed via the plugin, and noticed the same kinds problem a lot of other people have. It starts up, but at some point can become unresponsive (e.g. when adding folders and clicking the '+' button).

I dug a bit further, and the problem is unique to the jellyfin plugin, and persists whether or not you recreate (or create multiple instances of) the plugin.

There's also a way to check the existence of the problem, and it shows the issue is related to networking.

(I should note that I'm using VNET with a separate IP address, I don't know if this reproduces with NAT).

After installing the plugin, go to another host, and ping the new IP address. After about 30 seconds, the ping will stop receiving responses. Use the TrueNAS webUI to start a shell from the Jails tab (inside the plugin's jail), and try to ping outside of the jail (I use my default gateway, which is a pfsense router, but google.com works as well). As soon as a packet goes out, the ping running from your other host will start to connect again. Stop the ping from the jail, and after about 30 seconds or so, the outside connectivity will disappear as well.

This problem is unique to the jellyfin server. If you kill the jellyfin processes from inside of the jail, then networking returns to normal.

Based on these symptoms, I'm not sure whether the error is a FreeBSD issue or a jellyfin issue (maybe both), but I'm mostly interested in getting things running, so I just created an rc script to run a "ping" service that pings my router as long as jellyfin is running, and it ensures that everything works as it should.

Save this as `/etc/rc.d/ping`
Code:
#!/bin/sh
# File /etc/rc.d/ping

. /etc/rc.subr

name=ping
rcvar=ping_enable

command="/sbin/${name}"
command_args="-i 15 192.168.1.1 > /dev/null 2>&1 &"

sig_reload="USR1"

load_rc_config $name
run_rc_command "$1"


Run this to set proper permissions on the rc script and turn it on at startup
Code:
chmod 555 /etc/rc.d/ping
sysrc ping_enable="YES"
 
Last edited:

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
echo 'ping_enable="YES"' >> /etc/rc.conf
sysrc ping_enable="YES" is shorter to get the same result...

command_args="192.168.1.1 > /dev/null 2>&1 &"
You might want to consider something to spread out the pings a bit -i 20 rather than the default 1 second between pings.

I'm probably splitting hairs here as it's not a massive load, but no need to make it bigger than required (not sure how long that actually is).
 
Top