Network lag spikes when PMS is running

After 3 hours trying to figure out what was causing lag spikes on my LAN, I figured it out: PLEX. The minute I stop the service (I run it on CentOS 7) everything goes back to normal.

Here is what happens:

64 bytes from 192.168.0.254: icmp_seq=44 ttl=64 time=1.14 ms
64 bytes from 192.168.0.254: icmp_seq=45 ttl=64 time=0.521 ms
64 bytes from 192.168.0.254: icmp_seq=46 ttl=64 time=0.484 ms
64 bytes from 192.168.0.254: icmp_seq=47 ttl=64 time=1352 ms
64 bytes from 192.168.0.254: icmp_seq=48 ttl=64 time=352 ms
64 bytes from 192.168.0.254: icmp_seq=49 ttl=64 time=0.487 ms
64 bytes from 192.168.0.254: icmp_seq=50 ttl=64 time=0.518 ms
64 bytes from 192.168.0.254: icmp_seq=51 ttl=64 time=0.479 ms

That IP (192.168.0.254) is my gateway, a cable modem from my cable company. At first, I thought it could be a bad cable, nic, iptables, whatever. But as soon as I stop PMS, everything goes back to normal and its not a coincidence. I tested it over and over. I tried disabling all the network services from Plex (GDM, DLNA), nothing helped. Clean install, nada.

This is a Linux dedicated home server (Plex, Internet gateway, etc.) running CentOS 7 with 8GB ram, dual-core cpu and dual gigabit LAN.

I’m all ears… need to fix this :frowning:

Forgot to add, when PMS is not running:

— 192.168.0.254 ping statistics —
379 packets transmitted, 379 received, 0% packet loss, time 377996ms
rtt min/avg/max/mdev = 0.445/0.548/1.125/0.080 ms

As I said, this is not a coincidence. Im too tired to tcpdump right now, but Ill look into it tomorrow.

Doing a quick search I was able to find 6 threads regarding this issue… can we get a developer here?






What does wireshark and pcap show?

Finally, I was able to shutdown my entire network (lol, my home) to make it easier to read…

Frame 15 - ICMP request (thats me pinging)
Frame 16 - ICMP reply (awesome)

*** SOMETHING STARTS TO HAPPEN, LAG STARTS - THATS PLEX DOING IT *****

Frame 30 - ICMP request (ping again)

***** A LOT MORE STUFF GOING ON ***

Frame 37 - ICMP request (another one, still didnt get response from last one on frame 30)

*** MORE STUFF ****

Frame 43 - ICMP reply (requested on Frame 30 - that took a while! 1985ms to be precise)
Frame 44 - ICMP reply (requested on Frame 37 - a little less, but still a LOT - 985ms)

*** LAG CYCLE FINISHES ***

Two hosts appear on that capture:
50.116.49.5 - Frames 20 and 21 (li394-5.members.linode.com)
115.210.155.157 - Everything else

You can download the capture here:

@ChuckPA said:
What does wireshark and pcap show?

Check it out

Found the problem:

5 1.526984 192.168.0.1 239.255.255.250 SSDP 136 M-SEARCH * HTTP/1.1

Bingo!

Isnt that DLNA? I have mine disabled! The process “Plex DLNA Server” isnt even running… weird.

Well, please shouldnt be advertising anything on my 192.168.0.0/24 network, thats my WAN interface. It should only be advertising stuff on my 192.168.1.0/24 network, which is my LAN interface.

Is there a way to set the interface plex should advertise/listen to?

I see the frames you reference.

What about it? That’s your Plex Pass. Every so often it goes out to linode.com and verifies your Plex Pass features are active.

I don’t see where the issue is Plex. I think this needs to be diagnoses and, particularly, stress tested, Here’s why:

1 .If an ICMP packet takes that long to be replied to?? that’s either computer issue or network issue
2. If those 186 bytes Plex has used are bringing down your ability to play online, you have a network hardware (wiring?) issue.
3. You have packet retransmissions. Look at #41, and #47. This again points to something electrically wrong.

I think you’re running on the hairy edge of failure with something. Nudge it just a little and the sky falls.

Chuck, thanks for looking into it. I found out what the issue was, check this file:

Look into the following lines:

506
507
661
785
816
848

Those are the icmps getting delayed, what do they have in common? Check the three lines before each one:

503 24.063025 192.168.0.1 192.168.0.255 UDP 63 50570 → 32412 Len=21
504 24.063133 192.168.0.1 192.168.0.255 UDP 63 54388 → 32414 Len=21
505 24.063302 192.168.0.1 239.255.255.250 SSDP 136 M-SEARCH * HTTP/1.1

Sounds familiar? GDM and DLNA discovery. I turned off GDM and the two first packets are gone, but the lag still occurs. Turned off DLNA, but Plex still insists in sending that UDP 1900 packet, and thats where it hangs.

I guess some cable modems dont like getting poked by that, I dont know, but thats the reason some people turn off DLNA and the problem is gone (on some older versions), but, at least on 1.5.5, Plex still sends that packet on UDP 1900 even if DLNA is disabled.

How can I bind Plex to announce itself only on my LAN? Thats happening because its sending those packets on a interface it should not, my WAN!

So happy to finally found what the issue is…

By the way, on the first packet you commented, check lines 27, 28 and 29. Those are the problem, and not the lines below.

iptables -A OUTPUT -s 192.168.0.1 -d 239.0.0.0/8 -p udp -m state --state NEW -m udp --dport 1900 -j DROP
120 packets transmitted, 120 received, 0% packet loss, time 119001ms
rtt min/avg/max/mdev = 0.486/0.541/1.314/0.077 ms

Problem solved. No more DLNA advertising on my WAN, my cable modem is happy now :slight_smile:

You’re telling me a HTTP M-search (SSDP) is bringing you down? That’s the broadcast ping and the HTTP query to find out which Plex clients are on your network. I’m running two servers, 3 players, two desktops and 3 tablets, all responding to them without ill effect.

I’m running 5x the traffic you do in response to those.

I see what you’re pointing out and you have too much gap between packets ( > 0.1 seconds) for your network to be jammed up by Plex.

If you look at this photo, you can see where Gigabit is capable of 100,000 packets per second (of full payload), while you are showing tens of packets per second in the 100 byte range. Gigabit, at 128 bytes/packet will carry 1,000,000 packets per second. This is how it was designed and why it’s not uncommon to see file transfers of > 100MB / sec when reading over gigabit.

n/m I was composing while you were.

Well, believe me or not, there are 6 other threads full of people with the same issue. That SSDP packet must be malformed or something. Or its a bug in some cable modems chipset. Well, blocking that packet fixed the issue, hopefully this thread will save a few hours for someone with the issue if they search before asking, lol.

A cable modem which throttles PPS makes the most sense. I hadn’t thought of that until now (Thanks for that), but I can see where some cable providers wouldn’t want you spamming their over-subscribed coax. lol

Well, after all, this could easily be avoided if Plex had a setting to bind to interface X, right?

I wrote the GHI and the actual CODE for it MONTHS ago.

Not only does it bind to the interface, it picks up which interface is the default gateway from the routing table in the Linux kernel.

It literally is a piece of cake.

I dont think you got my “bind to interface” question…

I have two interfaces on my system:

eno1: WAN
eno2: LAN

I’d like Plex to only be available internally, but it binds itself to both
interfaces, it even broadcasts to both interfaces… :frowning:

2017-04-14 23:47 GMT-03:00 ChuckPA forums+d267406-s6025034@plex.tv:

Plex Forums https://forums.plex.tv/
ChuckPA answered your question: Network lag spikes when PMS is running

I wrote the GHI and the actual CODE for it MONTHS ago.

Not only does it bind to the interface, it picks up which interface is
the default gateway from the routing table in the Linux kernel.

It literally is a piece of cake.


Reply to this email directly or follow the link below to check it out:
https://forums.plex.tv/discussion/comment/1419512#Comment_1419512

Note: Your signature will be included when replying directly by email
unless you remove it first. Attachments will not be included when replying.

Check it out: https://forums.plex.tv/discussion/comment/1419512#
Comment_1419512

I understood what you wrote very clearly.

What I have wrote gives the ability to

a) select which interface(s) PMS works on
b) does not need to broadcast route discovery packets to find its way out to the internet because it will use what the OS knows (what you told it)

That said, You only would need to check the box for the adapter to use.

In your case: eno2 would be enabled, en01 would be disabled (unchecked).

Chuck, thats awesome! When will that code you wrote be implemented?

Em 15 de abr de 2017 12:41 AM, “ChuckPA” forums+d267406-s6025034@plex.tv
escreveu: