# Plex server hangs

**URL:** <https://forums.plex.tv/t/plex-server-hangs/186898>\
**Category:** General Discussions\
**Created:** [March 31, 2017, 3:28pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898 "2017-03-31T15:28:42Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![melrhombus](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@melrhombus](https://forums.plex.tv/u/melrhombus)\
**Post date:** [March 31, 2017, 3:28pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898/1 "2017-03-31T15:28:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [March 31, 2017, 4:10pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898/2 "2017-03-31T16:10:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![melrhombus](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@melrhombus](https://forums.plex.tv/u/melrhombus)\
**Post date:** [April 1, 2017, 4:43pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898/3 "2017-04-01T16:43:22Z")

</div>

Logs cover two instances of the hang

1. March 28th - killed -9’d around 7:50ish
2. 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?

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 1, 2017, 5:08pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898/4 "2017-04-01T17:08:25Z")

</div>

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

```auto
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?

---

<div class="post-metadata">

**Author:** ![melrhombus](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@melrhombus](https://forums.plex.tv/u/melrhombus)\
**Post date:** [April 1, 2017, 5:23pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898/5 "2017-04-01T17:23:30Z")

</div>

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

 ![](https://sea1.discourse-cdn.com/plex/uploads/default/original/3X/4/5/4517700c331a029fc52a8e5f85bd1e320d2079f6.jpg)

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?

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 1, 2017, 5:33pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898/6 "2017-04-01T17:33:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![melrhombus](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@melrhombus](https://forums.plex.tv/u/melrhombus)\
**Post date:** [April 1, 2017, 5:50pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898/7 "2017-04-01T17:50:02Z")

</div>

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?

 ![](https://sea1.discourse-cdn.com/plex/uploads/default/original/3X/3/7/375020fcb0f22f530bd74a029b2bc273ad4ed17a.jpg)

---

<div class="post-metadata">

**Author:** ![melrhombus](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@melrhombus](https://forums.plex.tv/u/melrhombus)\
**Post date:** [April 1, 2017, 8:42pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898/8 "2017-04-01T20:42:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 1, 2017, 8:47pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898/9 "2017-04-01T20:47:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![melrhombus](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@melrhombus](https://forums.plex.tv/u/melrhombus)\
**Post date:** [April 1, 2017, 9:08pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898/10 "2017-04-01T21:08:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 2, 2017, 5:06pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898/11 "2017-04-02T17:06:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![melrhombus](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@melrhombus](https://forums.plex.tv/u/melrhombus)\
**Post date:** [April 2, 2017, 7:08pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898/12 "2017-04-02T19:08:13Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 2, 2017, 7:31pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898/13 "2017-04-02T19:31:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 2, 2017, 7:42pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898/14 "2017-04-02T19:42:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![melrhombus](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@melrhombus](https://forums.plex.tv/u/melrhombus)\
**Post date:** [April 3, 2017, 4:03pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898/15 "2017-04-03T16:03:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SwiftPanda16](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/swiftpanda16/32/81839_2.png) [@SwiftPanda16](https://forums.plex.tv/u/SwiftPanda16)\
**Post date:** [April 5, 2017, 9:11pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898/16 "2017-04-05T21:11:35Z")

</div>

One more thing you can test in PlexPy is going to [Settings \> Homepage \> Sections](https://i.imgur.com/bxIJR6e.png) 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.

---

<div class="post-metadata">

**Author:** ![melrhombus](https://avatars.discourse-cdn.com/v4/letter/m/71c47a/32.png) [@melrhombus](https://forums.plex.tv/u/melrhombus)\
**Post date:** [April 11, 2017, 1:13am UTC](https://forums.plex.tv/t/plex-server-hangs/186898/17 "2017-04-11T01:13:20Z")

</div>

Narrowed it down to the Recently Added

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [January 7, 2020, 11:02pm UTC](https://forums.plex.tv/t/plex-server-hangs/186898/18 "2020-01-07T23:02:57Z")

</div>


