Hi folks. I have been seeing issues in Plex for about a week and a half.
Issue: Spinning activity monitor in Plex Web + unable to scan my libraries and usually is so slow it doesn’t allow users to play media (internally or externally).
Repeating issues in the Plex Media Scanner.log file:
Aug 03, 2021 11:35:51.216 [0x7f86db445848] WARN - SLOW QUERY: It took 8040.000000 ms to retrieve 0 items.
Aug 03, 2021 11:35:58.426 [0x7f86db445848] WARN - SLOW QUERY: It took 7200.000000 ms to retrieve 0 items.
Aug 03, 2021 11:36:07.076 [0x7f86db445848] WARN - SLOW QUERY: It took 8640.000000 ms to retrieve 0 items.
Aug 03, 2021 11:36:14.470 [0x7f86db445848] WARN - SLOW QUERY: It took 7370.000000 ms to retrieve 0 items.
Environment:
Plex version: plexmediaserver-1.23.6.4881-e2e58f321.x86_64 (but had the issue in two versions before this as well)
Linux OS (CentOS 7), fully patched.
Running in a VM in Proxmox
12 CPUs, 48GB RAM
Storage:
/var/lib/plexmediaserver: RAID 5 SSDs on attached Synology NAS presented over NFS v3 (1.7TB available out of 2TB)
Media storage: 60TB RAID 6 HDDs on a Synology NAS, also presented over NFS v3 (15TB free)
Movies: 4577
TV Shows: 463
The layout above has not changed in many months, but this issue is just now presenting itself.
I have run the “Optimize Database” twice (once today and a few days ago) which took about 30 mins each time. Both were successful but the issue persisted.
I ran the SQLIte repair database check, and it completes in less than a second without any output.
I have no issues with hardware (switches, cables) or Proxmox host issues that I can tell, so I’m running out of ideas.
I have viewed other “slow query” posts and tried various items (as mentioned above) but so far these aren’t solving it.
I have downloaded my logs, but please confirm if I should upload them directly here or somewhere else. Thank you for any ideas/help!
The issue still persists and seems to help for a few hours by restarting the service, but obviously that doesn’t solve it. The log files from 2 days ago when I originally posted + right now are attached if anyone has any input. Thank you![Plex Media
As an update, I have upgraded my plexmediaserver software in case it would help. I’m still seeing the same issues from a client POV, but looks like the messages are changing slightly from my earlier posts, as shown below:
plexmediaserver process status:
[jake@plex ~]$ sudo systemctl status plexmediaserver
● plexmediaserver.service - Plex Media Server
Loaded: loaded (/usr/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2021-08-31 05:43:18 PDT; 4h 18min ago
Process: 8426 ExecStartPre=/bin/sh -c /usr/bin/test -d “${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}” || /bin/mkdir -p “${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}” (code=exited, status=0/SUCCESS)
Main PID: 8429 (Plex Media Serv)
CGroup: /system.slice/plexmediaserver.service
├─8429 /usr/lib/plexmediaserver/Plex Media Server
├─8471 Plex Plug-in [com.plexapp.system] /usr/lib/plexmediaserver/Resources/Plug-ins-1a38e63c6/Framework.b… ├─8515 /usr/lib/plexmediaserver/Plex Tuner Service /usr/lib/plexmediaserver/Resources/Tuner/Private /usr/l… ├─8545 Plex Plug-in [com.plexapp.plugins.WebTools] /usr/lib/plexmediaserver/Resources/Plug-ins-1a38e63c6/F… ├─8547 Plex Plug-in [com.plexapp.agents.subzero] /usr/lib/plexmediaserver/Resources/Plug-ins-1a38e63c6/Fra… ├─9248 Plex EAE Service
└─9397 /usr/lib/plexmediaserver/Plex Transcoder -codec:0 h264 -codec:1 ac3 -ss 4671 -noaccurate_seek -■■■■…
Aug 31 09:50:10 plex sh[8429]: Sqlite3: Sleeping for 200ms to retry busy DB.
Aug 31 09:50:10 plex sh[8429]: Sqlite3: Sleeping for 200ms to retry busy DB.
Aug 31 09:50:10 plex sh[8429]: Sqlite3: Sleeping for 200ms to retry busy DB.
Aug 31 09:50:10 plex sh[8429]: Sqlite3: Sleeping for 200ms to retry busy DB.
Also, the slow query messages are still there, but now giving an actual number of what it’s trying to retrieve, vs. the previous 0 results.
[jake@plex Logs]$ grep -i slow *.log
Plex Media Server.log:Aug 31, 2021 09:49:14.283 [0x7f054a8aab38] WARN - SLOW QUERY: It took 320.000000 ms to retrieve 15 items.
Plex Media Server.log:Aug 31, 2021 09:49:14.359 [0x7f054ab56b38] WARN - SLOW QUERY: It took 520.000000 ms to retrieve 12 items.
Plex Media Server.log:Aug 31, 2021 09:49:14.662 [0x7f0549d30b38] WARN - SLOW QUERY: It took 400.000000 ms to retrieve 84 items.
Plex Media Server.log:Aug 31, 2021 09:49:16.277 [0x7f054bf8bb38] WARN - SLOW QUERY: It took 210.000000 ms to retrieve 50 items.
Plex Media Server.log:Aug 31, 2021 09:49:17.043 [0x7f054984fb38] WARN - SLOW QUERY: It took 810.000000 ms to retrieve 1 items.
Plex Media Server.log:Aug 31, 2021 09:49:17.044 [0x7f05499a9b38] WARN - SLOW QUERY: It took 810.000000 ms to retrieve 1 items.
Plex Media Server.log:Aug 31, 2021 09:51:05.550 [0x7f054be30b38] WARN - SLOW QUERY: It took 240.000000 ms to retrieve 12 items.
Also, as an FYI, my database file is much larger than most others that I’ve seen in the threads. Likely related, but I’m not sure I mentioned this earlier so I apologize:
[jake@plex Databases]$ ls -alh com.plexapp.plugins.library.db
-rw-r–r-- 1 plex plex 6.7G Aug 31 10:05 com.plexapp.plugins.library.db
Current plex version: plexmediaserver-1.24.1.4931-1a38e63c6.x86_64
OS: CentOS 7
Hey @ChuckPa , thanks for the question! Yes, it’s on an NVMe SSD on my NAS, but shared across a 10G fiber link using NFS. I started having the issues with it while on that though.
I do know that the DB was around 500M around April of this year, so I’m guessing since then it was associated with me turning on video preview thumbnails to my Movies library. The TV library does not have them enabled.
Total movies: 4618
Total TV episodes: 29,137
(Songs and photos are under 100 each so not worth counting)
Yeah, I wasn’t going for 10G speeds per se, more of just using the gear I already had. Is there a minimum read/write speed for something like that to work reliably?
Ideally, rebuilding the DB is something I’d consider, but when I tried to do that a few weeks back it did not export my entire watch history (using this page) so I reverted to the current DB. It was odd, part of it was there but a lot of it wasn’t.
Here are the sizes per your request:
[root@plex ~]# du -ms /var/lib/plexmediaserver
151360 /var/lib/plexmediaserver
[root@plex ~]# ls -lah /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/Databases/com.plexapp.plugins.library.db
-rw-r–r-- 1 plex plex 6.7G Aug 31 11:50 /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db
Yep, I can do that. The 2nd option looks quick enough to play around with.
But before that, I realized I may have no been clear with how the storage is provisioned. My Plex VM is in Proxmox and has a 300GB disk allocated to it from my NAS over NFS v3. So the NFS portion is handled via Proxmox storage and I’m setting up the disk inside the VM using LVM and mounting /var/lib/plexmediaserver onto it. So I’m not directly setting up the NFS mount in /etc/fstab.
Apologies for not being clear on that earlier. I still think your idea of breaking out Media and Metadata could be helpful, setting up the two unique mount points but keeping the rest on the local SSD inside of Proxmox. Thoughts?
Agree whole heartedly! Terribly sorry, definitely my bad. I had some of this in my original post way above but realized the NFS piece wasn’t defined well enough to explain it wasn’t a direct mount in /etc/fstab.
I should be able to make the changes within a few days, but in the meantime I wanted to ask @ChuckPa on this part:
Is my DB just fubar’ed or is this expected if the video preview thumbnails are enabled? I’d love to try and fix the DB size as well as the speed of reading it so I’m curious as to why it got so bloated.
Without going in and counting the number of records in each of the tables, it’s impossible to know.
The first, and obvious, question to ask:
When was the last time you did a full and proper, Scan Files, Empty Trash, Clean Bundles, and Optimize Database in that sequence?
That said, have you considered a full compaction of the DB using Plex SQLite to .dump and then reimport. (This makes it its absolute smallest… and easiest to test without harming live data; Import into a dummy file)
Hey there! Yeah, I have run the items in your first bullet point within the past few weeks. The clean bundles and empty trash are set to automatic via the scheduler so they’ve been more recently, but I just re-ran them again in that order.
For the “Scan Files”, you’re just referring to scanning the libraries, right? If so, I also have that automatic to scan every 2 hours.
The DB scan always takes about 30 minutes, and from reading up on these forums, that’s like 29+ minutes too long. It just took about that long again, sadly
For bullet point #2, I just did that and re-imported it into a dummy file. It went from 6.6GB to 6.2GB. Somewhat better, but still large.