Apple TV app causing high CPU load on server

I am asking all this because I am starting to wonder if there might be two DB issues here.

Your database clearly doesn’t have the well-known & defined “extras duplicate records” problem.

Therefore, I am curious what it might be.

Could I get a ZIP copy of your DB and blobs DB when PMS is stopped sometime?

1 Like

I have never experienced that problem, running the latest stable PMS with at least 6 users using AppleTVs regularly. Not sure if 2017 or 2021 version. Mine is 2017.
My server is not using any LiveTV/Record features.

1.1G	com.plexapp.plugins.library.blobs.db
160M	com.plexapp.plugins.library.db

If you need any other stats to compare, let me know.

1 Like

Ya, I will message you on the forums privately within maybe 12 hours.

1 Like

Reproducing the crashes while watching something takes a few DAYS for me. Always under the condition that the Apple TV/the app is not restarted in the meantime.

Still no subtitles involved.

Not reproduce-able for me intentionally unfortunately :frowning:

That’s what I experience too. The longer the Plex app on Apple TV is running the worse it gets. In the beginning there are only short spikes and content’s loading pretty quickly. After some runtime it gets slower and slower and the CPU stays at 100% until everything’s loaded.

My DB is only 95MB respectively 325MB for the .blobs

Looks the same here but without the “no content” error. But browsing causes a significantly strain for the CPU. ONLY on Apple TV.

a2169

1 more. I was just looking at the plex dashboard. all of a sudden CPU is at 80% and nothing is being played. My wife just woke up though. “Honey did you just open plex? Ya, its not working, why?” lol. My wife has been complaining about plex for months. She hates it now.

She is using the same AppleTV device that I have been testing with. We have 4 of them in the house, a2169.

I just went around and un-installed the Plex App from 3 of the 4 AppleTV’s in the house. For now everyone is going to have to use an iOS device and airplay to the AppleTV’s.

Feature Request: A blacklist for client types. I want to be able to block AppleTV clients with specific versions, using the Plex Server web interface.

I thought it was related to playback, but now I can confirm with my testing that just browsing with AppleTV can trigger this issue.

It’s not just the CPU usage, plex does crazy amount of read write on the SSD with IOPS > 5000 non stop for greater than 10 mins. The memory also shoots up from 300 MB to 3GB. The media file that I am playing is less a GB.

I can have 4 streams running smoothly (plex using 600 MB), the moment one AppleTV starts playback, the server goes into this CPU/IO loop (memory > 4GB) until it becomes unresponsive and everyone loses their connection with plex. It’s like anyone with an AppleTV can DDoS my server.

1.24.2.4973 does not have this issue with latest Apple TV. Every single version after that, I can easily reproduce within a day.

Would it be possible to get a ZIP of your Plex database?

We can’t reproduce this (memory bloat) EXCEPT in those cases where the DB bloated (for which there is a fix)

Here is what my plex memory usage looks like every time I hit play from an AppleTV (300MB to 3GB). I am using latest versions of server and client as of today. It surprisingly didn’t become unresponsive today.

Please let us know what the fix is, I will try it out.

I can give you the basic query (run as a scheduled task - user script) for DSM 7.

If you have DSM 6, please let me know an I’ll change the paths.

#!/bin/bash

SQLite="/var/packages/PlexMediaServer/target/Plex SQLite"

# This looks like multiple lines but is one VERY long line
DB="/var/packages/PlexMediaServer/shares/PlexMediaServer/AppData/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db"

# This also looks like multiple lines but is one long SQL query
Command="select count(metadata_item_id),metadata_item_id from metadata_relations group by metadata_item_id order by count(metadata_item_id) desc limit 20"

# Now to make it happen
echo "$Command" | "$SQLite"  "$DB"

Instructions:

  1. Stop Plex
  2. Run as ‘root’
  3. Email you the output

A normal DB will look like this

bash-4.4# echo "$Command" | "$SQLite"  "$DB"
60|621
35|53
35|709
31|140
31|308
31|640
30|52
30|167
29|72
29|322
29|635
29|675
28|595
27|232
27|594
26|70
26|170
25|103
25|695
21|264
bash-4.4# 

A bloated DB will look like this (Notice the COUNT for the first two records)

761863|57236
524292|56545
54|58237
51|56604
51|57096
47|59056
34|55911
33|57576
31|56926
31|57314
30|22739
30|57175
30|57590
30|57890
30|58039
28|56713
28|57832
27|318
27|56934
26|57660

My db is under 300 MB, and metadata_relations is empty.

Plex on AppleTV has been completely unusable for me after 1.24.2.4973. I can’t even browse the content without triggering massive memory spikes on the server, I see “No Content” on the TV.

I am lucky in that as far as I know no one I share my server with uses AppleTV. If they did, I would have to remove their access.

I went out and bought 3 Roku Ultra LT’s. My issue is resolved :roll_eyes:

The old ‘throwing money at the problem’-Fix.

There are 3 users I share my server with. ALL 3 OF THEM — AppleTV 4K.

There are NO issues. I have tried, others have tried, but nobody can reproduce the error.

So what is with these two cases?

AppleTV firmware? Number of apps installed on the device ?

LAN network configuration?

Really need to start listing the finest of details.

  • tvOS version ?
  • Last tine device restarted ?
  • ISP ?
  • Global region ?
  • which LAN subnet ? (192.168 , 10., 172.16 ) ?
  • VLANs ?
  • DHCP server for the ATV 4K ? mac address reservation?
  • 2.4 Ghz / 5 Ghz?
1 Like

The memory bloat and fix is being tested with a group of users now,
Those users also have databases which demonstrate the fault I showed above.

To be clear, the format of the above output is ( Record_count | Media_item_id )
Record_Count > 100 is a concern.

These cases are those which cause the “3am failurres” during maintenance so many are reporting (OOM errors)

I was about to do the same until I found out that downgrading to an older version works.

I tried your query, it did not return any records.

I think this needs a fix on the server. The latest version of plex on my Apple TV works perfectly fine with server 1.24.2.4973. I have never had plex server go crazy and unresponsive. However, every single version after that I run into this issue.

I also cannot reproduce this issue every time. It just shows up randomly. And it occurs frequently enough for me to notice and kill my server.

You have NO returned results (no records) ?
-or-
No record counts > 100 ?

0 records