Since a couple updates ago I’m seeing my plex server go unresponsive
It’s running but you can’t connect to it locally or remote
If you try to shut it down it just hangs and you are forced to kill -9 the process
Once it’s restarted it comes up fine but I’m not sure if it’ll stay up… I can’t be certain but I think this happens every time I update the app since 1.5… several hours after an update it gets “stuck”. Speculation though…
I’ll post some logs when I get home but curious if anyone else is seeing this behavior
Until you share your logs, anything else is speculation.
When you get the chance, just generate the normal full ZIP logs PMS gives you and attach it here. We’ll take a look
Logs cover two instances of the hang
- March 28th - killed -9’d around 7:50ish
- March 31st - killed -9’d around 12:20ish
Both cases doing a systemctl restart plexmediaserver.service would hang and was forced to kill -9 the main process (the others shutdown though… just the main one lingered)
Logs are pretty sparse 
Hasn’t happened again… should I run in debug for awhile?
Thanks for those logs.
I see you have some serious issues there.
Plex Media Server.2.log (the first useful file) shows almost exclusively timeout errors and it shows your database is very slow and needs to be optimized. Easy to do but when it gets out of hand, PMS’s internal components are unable to get in and out of the database in time. you see the snowball effect in this which hang, don’t respond, etc etc)
Mar 29, 2017 20:50:28.698 [0x7f7667bff700] WARN - SLOW QUERY: It took 340.000000 ms to retrieve 50 items.
I then see
Mar 30, 2017 09:20:10.058 [0x7f76613fd700] ERROR - Error issuing curl_easy_perform(handle): 52
Mar 30, 2017 09:20:10.058 [0x7f76613fd700] WARN - HTTP error requesting GET http://192.168.1.211:8088/description (0, No error) (Empty reply from server)
Mar 30, 2017 09:45:53.821 [0x7f76323fe700] WARN - NAT: PMP, got an error: Not Supported by gateway.
Mar 30, 2017 10:11:00.263 [0x7f762e3f6700] ERROR - Error issuing curl_easy_perform(handle): 52
Mar 30, 2017 10:11:00.263 [0x7f762e3f6700] WARN - HTTP error requesting GET http://192.168.1.211:8088/description (0, No error) (Empty reply from server)
While not concerned about the NAT PMP error per se, the curl 52 error tells me there’s a connectivity issue reaching out to the router/switch/gateway the host is using. When it’s an error 52, that’s an empty reply… Again, not an error but also not good with nothing but that in the log file and so frequently. The implication here is networking at this point.
port 8088 is of concern. A proxy?
This is very concerning… Not even enough time / resources to shutdown cleanly (the easiest thing to do).
Can you help me understand what’s going on here? Is this a Xeon VM?
Do you have something I can read about optimizing the DB?
Not a VM but an old HP Proliant Xeon server and not taxed at all… aside from when multiple transcodes occur this is the normal idle state which is what it was like at the time of the hangup
That .211:8088 is actually my harmony hub… I’m using the Echo/Plex/Harmony combo
I think the hub does that what there’s nothing to say… like a default I’m idle response… not really sure but it’s spammy for sure
Note this box has had plex on it for a VERY long time and I’ve just been upgrading as releases come… is it looking like I need a fresh start?
Optimizing the Database is really easy.
Hover the mouse anywhere in your Libraries block on the left. You’ll see the ellipsis show up to the right of ‘Libraries’. Click it and you’ll exose ‘Optimize Database’. Click that. Let it sit for about a minute (it actually depends on physical library size) to get it all done. When the HD(s) are quiet again, it’s done.
I would, at that point, recommend restarting Plex.
Given your database was fragmented as it was, I’ll presume you added a lot of media to it at one point or haven’t configured it for automatic maintenance?
If you’ve added, moved or removed a lot of media over time, this is what it manifests as. The next thing to do is (also under the ellipsis) Empty Trash and Clean Bundles. If you do that, it doesn’t hurt to Optimize the Database again but I don’t see a need to restart (your choice there).
Regarding maintenance, Settings - Server - Scheduled Tasks. In there are the options to enable the database Optimization. Just click it and you’re set.
If you turn the machine off when maintenance is supposed to run, then we know why it’s not happening. Selecting different hours to run maintenance would be a good idea while in there.
Edit: Unless we find overwhelming evidence, I see no reason for you to start over. I think a nice dose of maintenance will get things back in order for you
Actually I’ve had this config like below for about a year now
I’ll run that manually and keep in eye on it
It’s on 24/7 so shouldn’t be skipping anything… only issue I run into is sometimes the NAS goes to sleep and doesn’t wake up fast enough for Plex to do the DB backup
Edit: I’ve read some others had issues with the scheduled scans… by chance maybe it’s affecting all scheduled tasks?
Something I noticed… all those SLOW QUERY messages tend to get generated when I use plexpy
I’ve yet to see when via the web ui itself or if browsing through roku
Not to challenge, but can you create a scenario where you can document it? (a “steps to reproduce” sequence)
If you can, we can reach out to the PlexPy dev and to those he works with
Pretty simple… just open plexpy in your browser
Not seeing it happen if I dig through libraries… only when I go to the home page
It’s quite consistent… hit refresh and I get a new entry
Apr 01, 2017 17:52:09.240 WARN SLOW QUERY: It took 340.000000 ms to retrieve 50 items.
Apr 01, 2017 17:50:50.136 WARN SLOW QUERY: It took 320.000000 ms to retrieve 50 items.
Apr 01, 2017 17:50:45.198 WARN SLOW QUERY: It took 320.000000 ms to retrieve 50 items.
Apr 01, 2017 17:50:16.398 WARN SLOW QUERY: It took 360.000000 ms to retrieve 50 items.
Running plexpy v1.4.17 (2017-03-04) against Plex v1.5.2.3557
So far the only other db issues I’ve seen since optimizing is it blocked while I was updating the library which I assume is normal as I added some new albums
Thanks again for all the help btw! I do find the web ui is now loading faster… posters and lib updates are snappier
When adding a lot of media, which adds each song to the library as an item and then adds the album, will often make the database ‘lopsided’. This is the ‘slow query’ most people see.
In your case, I need to know what you’re doing with PlexPy that will cause this. If you can find the spot in PlexPy where the SLOW QUERY instances start to rise, this is what I need.
Linux’s tail -F "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs/Plex Media Server.log" will allow you to watch the log file in real time in a terminal window while interacting with PlexPy. This makes it incredibly easy to screen capture what’s happening
I was tailing the log and the only time I saw that was on plexpy home page where it’s loading all the library and stats
http://ip:9001/home is what I mean by home page
Every time I go here or hit refresh I get a SLOW query in the Plex log
THere is only one more thing known here to do.
Change PlexPy to use "WebSockets’. "toggle Settings - Activity Monitoring - ‘Use Websocket (requires restart)’ "
After this point, if no improvement, the next step is the PlexPy support thread. We’re sorry but PlexPy is making a query which is hard-locking PMS. Until it stops making that hard-lock query, there’s nothing else we can say/do.
It appears ownership of PlexPy has been transferred .
I am told:
Reddit, where the current dev hangs out
Name of dev is SwiftPanda16
I hope this is of help
Yeah, I’ve tried the websocket and query version… both show the same
I’m not too concerned over it as it only happens on the home page
The manual optimize seems to have fixed the other issues… several days and no hangs
One more thing you can test in PlexPy is going to Settings > Homepage > Sections and only enabling one section at a time. Then go back to load the homepage to see if you can identify which section is causing it to hang.
Narrowed it down to the Recently Added