Server Version#: 1.24.5.5173
Player Version#: 1.35.1.2632-c6783c78
For weeks I had problems with PMS Crashing. I couldn’t find anything in the server logs.
When I looked at the warning on my NAS every time PMS crashed it read: The memory utilization has reached ~90%
So my first thought was; PMS causes a memory leak.
I couldn’t find an satisfying answer on the forums.
After a lot of reading and trying random stuff, I looked at the size of the Database file. My DB was around 6 GB. I tried the DB repair instructions of the support site but nothing changed. Eventually I tried looking in the database file with SQLite Database Browser. There I found millions of duplicate records in several tables!!!
I noticed that the duplicates were extras from 4 movies. So in my library I turned off the option “Find extras” and PMS immediately began to delete the duplicate records. At least that is what I saw in the management console of the client. After 3 days it still was not finished, so I stopped PMS on my NAS. I looked at the database and nothing had changed. Stopping it prematurely meant the changes where not committed to the database, Fun!
I was not going to start over so I wrote SQL queries to delete the duplicate records. Stopped PMS and went to work in the following order:
– 3174,3638,3597,3818 are the metadata item id’s from my movies with a problem
DROP TRIGGER “main”.“fts4_metadata_titles_before_delete_icu”;
DELETE FROM media_parts
WHERE media_item_id IN (
SELECT mdi.id
FROM media_items AS mdi
INNER JOIN metadata_relations AS mr ON mr.related_metadata_item_id = mdi.metadata_item_id
WHERE mr.metadata_item_id IN (‘3174’,‘3638’,‘3597’,‘3818’)
)
DELETE FROM media_streams
WHERE media_item_id IN (
SELECT mdi.id
FROM media_items AS mdi
INNER JOIN metadata_relations AS mr ON mr.related_metadata_item_id = mdi.metadata_item_id
WHERE mr.metadata_item_id IN (‘3174’,‘3638’,‘3597’,‘3818’)
)
DELETE FROM media_items
WHERE id IN (
SELECT mdi.id
FROM media_items AS mdi
INNER JOIN metadata_relations AS mr ON mr.related_metadata_item_id = mdi.metadata_item_id
WHERE mr.metadata_item_id IN (‘3174’,‘3638’,‘3597’,‘3818’)
)
DELETE FROM metadata_items
WHERE id IN (
SELECT related_metadata_item_id
FROM metadata_relations AS mr
WHERE mr.metadata_item_id IN (‘3174’,‘3638’,‘3597’,‘3818’)
)
DELETE FROM metadata_relations
WHERE metadata_item_id IN (‘3174’,‘3638’,‘3597’,‘3818’)
CREATE TRIGGER fts4_metadata_titles_before_delete_icu BEFORE DELETE ON metadata_items BEGIN DELETE FROM fts4_metadata_titles_icu WHERE docid=old.rowid; END
The database file was still 6 GB. After I started PMS on my NAS and started the OPTIMIZE DATABASE command in the Plex client, the DB file shrank to around 350 MB. And now I have no more problems… yay!!
I hope this helps someone. I still don’t know what caused this…