Plex being killed by QTS on QNAP TS-431X2 with 8GB RAM

Server Version#: 1.40.1.8227 (QNAP - PlexMediaServer-1.40.1.8227-c0dd5a73e-armv7neon.qpkg)
Player Version#: N/A

This problem started fairly recently; within the last few months at least. Running Plex and SMB sharing the directories is literally the only thing the NAS does for me, and has been fine for several years. My collection is about 10TB, though, and I have recently added a big chunk of TV media to it (Something like 400GB).

I’ve attached my server logs for review.

I just ran the DBRepair.sh tool from @ChuckPa, which exited with an “Unexpected EOF” after the “Automatic Check., Repair/optimize, & Index successful”.

BusyBox v1.01 (2024.02.19-03:31+0000) multi-call binary

Usage: readlink

Displays the value of a symbolic link.




      Plex Media Server Database Repair Utility (QNAP)
                       Version v1.05.01


[2024-03-24 08.48.16] Automatic Check,Repair,Index started.
[2024-03-24 08.48.16]
[2024-03-24 08.48.16] Checking the PMS databases
[2024-03-24 08.48.23] Check complete.  PMS main database is OK.
[2024-03-24 08.48.27] Check complete.  PMS blobs database is OK.
[2024-03-24 08.48.27]
[2024-03-24 08.48.27] Exporting current databases using timestamp: 2024-03-24_08.48.16
[2024-03-24 08.48.27] Exporting Main DB
[2024-03-24 08.48.39] Exporting Blobs DB
[2024-03-24 08.56.00] Successfully exported the main and blobs databases.  Proceeding to import into new databases.
[2024-03-24 08.56.00] Importing Main DB.
[2024-03-24 08.56.30] Importing Blobs DB.
[2024-03-24 08.56.54] Successfully imported databases.
[2024-03-24 08.56.54] Verifying databases integrity after importing.
[2024-03-24 08.57.00] Verification complete.  PMS main database is OK.
[2024-03-24 08.57.01] Verification complete.  PMS blobs database is OK.
[2024-03-24 08.57.01] Saving current databases with '-BACKUP-2024-03-24_08.48.16'
[2024-03-24 08.57.01] Making repaired databases active
[2024-03-24 08.57.01] Repair complete. Please check your library settings and contents for completeness.
[2024-03-24 08.57.01] Recommend:  Scan Files and Refresh all metadata for each library section.
[2024-03-24 08.57.01]
[2024-03-24 08.57.01] Backing up of databases
[2024-03-24 08.57.01] Backup current databases with '-BACKUP-2024-03-24_08.57.01' timestamp.
[2024-03-24 08.57.03] Reindexing main database
[2024-03-24 08.57.11] Reindexing main database successful.
[2024-03-24 08.57.11] Reindexing blobs database
[2024-03-24 08.57.13] Reindexing blobs database successful.
[2024-03-24 08.57.13] Reindex complete.
[2024-03-24 08.57.13] Automatic Check, Repair/optimize, & Index successful.
[2024-03-24 08.57.13] Unexpected EOF / End of command line options. Exiting. Keeping temp files.

[2024-03-24 08.57.13] Unexpected exit command.  Keeping all temporary work files.

Quick side note - I had to change the script params for df to remove the POSIX mode flag as it was returning an error when I ran it.

Any ideas?
plexlogs.tar.gz (3.1 MB)

  1. Not sure how you did this but it looks like you’ve got symlinks involved

Here is 1) Running while logged into the 1GB TS128 then 2) SSH invocation on the same host

[/share/Public] # ./DBRepair.sh 
 
 
 
      Plex Media Server Database Repair Utility (QNAP)
                       Version v1.05.01
 

Select

  1 - 'stop'      - Stop PMS.
  2 - 'automatic' - Check, Repair/Optimize, and Reindex Database in one step.
  3 - 'check'     - Perform integrity check of database.
  4 - 'vacuum'    - Remove empty space from database without optimizing.
  5 - 'repair'    - Repair/Optimize databases.
  6 - 'reindex'   - Rebuild database database indexes.
  7 - 'start'     - Start PMS

  8 - 'import'    - Import watch history from another database independent of Plex. (risky).
  9 - 'replace'   - Replace current databases with newest usable backup copy (interactive).
 10 - 'show'      - Show logfile.
 11 - 'status'    - Report status of PMS (run-state and databases).
 12 - 'undo'      - Undo last successful command.

 21 - 'prune'     - Prune (remove) old image files (jpeg,jpg,png) from PhotoTranscoder cache.
 42 - 'ignore'    - Ignore duplicate/constraint errors.

 88 - 'update'    - Check for updates.
 99 - 'quit'      - Quit immediately.  Keep all temporary files.
      'exit'      - Exit with cleanup options.

Enter command # -or- command name (4 char min) : ^C
[/share/Public] # logout        
Connection to ts128 closed.
[chuck@lizum PlexDBRepair.2007]$ gots128 /share/Public/DBRepair.sh stop auto start exit
 
 
 
      Plex Media Server Database Repair Utility (QNAP)
                       Version v1.05.01
 
 
[2024-03-24 12.35.23] Stopping PMS.
[2024-03-24 12.35.29] Stopped PMS.
 
[2024-03-24 12.35.29] Automatic Check,Repair,Index started.
[2024-03-24 12.35.29] 
[2024-03-24 12.35.29] Checking the PMS databases
[2024-03-24 12.36.07] Check complete.  PMS main database is OK.
[2024-03-24 12.36.08] Check complete.  PMS blobs database is OK.
[2024-03-24 12.36.08] 
[2024-03-24 12.36.08] Exporting current databases using timestamp: 2024-03-24_12.35.29
[2024-03-24 12.36.08] Exporting Main DB
[2024-03-24 12.36.49] Exporting Blobs DB
[2024-03-24 12.37.04] Successfully exported the main and blobs databases.  Proceeding to import into new databases.
[2024-03-24 12.37.04] Importing Main DB.
[2024-03-24 12.39.15] Importing Blobs DB.
[2024-03-24 12.39.15] Successfully imported databases.
[2024-03-24 12.39.15] Verifying databases integrity after importing.
[2024-03-24 12.39.47] Verification complete.  PMS main database is OK.
[2024-03-24 12.39.47] Verification complete.  PMS blobs database is OK.
[2024-03-24 12.39.47] Saving current databases with '-BACKUP-2024-03-24_12.35.29'
[2024-03-24 12.39.47] Making repaired databases active
[2024-03-24 12.39.47] Repair complete. Please check your library settings and contents for completeness.
[2024-03-24 12.39.47] Recommend:  Scan Files and Refresh all metadata for each library section.
[2024-03-24 12.39.47] 
[2024-03-24 12.39.47] Backing up of databases
[2024-03-24 12.39.47] Backup current databases with '-BACKUP-2024-03-24_12.39.47' timestamp.
[2024-03-24 12.39.48] Reindexing main database
[2024-03-24 12.40.16] Reindexing main database successful.
[2024-03-24 12.40.16] Reindexing blobs database
[2024-03-24 12.40.16] Reindexing blobs database successful.
[2024-03-24 12.40.16] Reindex complete.
[2024-03-24 12.40.16] Automatic Check, Repair/optimize, & Index successful.
 
[2024-03-24 12.40.16] Starting PMS.
[2024-03-24 12.40.16] Started PMS
 
[chuck@lizum PlexDBRepair.2008]$ 

There are no script errors on QTS (I develop on Ubuntu and test on QTS & DSM)
QTS/QuTS is what necessitated the addition of POSIX mode for df

Did you Copy/Paste the body of the script and drop characters along the way?

Which version of QTS ?

QTS 5.1.5.2679

Downloaded file from github onto PC, then immediately uploaded to NAS

Symlink might have been a thing I did years ago and forgot about…where should I be checking for those that the script would be hitting them?

Did you use the tar.gz or did you use the sh ?

Windows will break the SH file immediately

The sh file, but Windows doesn’t “immediately” break the file - it will replace LF with CRLF if you open it in Windows Notepad and then save it, but it doesn’t just do that automatically. I have a proper text editor, so even if I did the intermediate step of looking at/editing the file before uploading it to the NAS, it wouldn’t have broken the file.

When running the unedited script, I got an error that the option ‘P’ is invalid; I get the same error if I try to do it directly from the CLI:

# df -P
df: invalid option -- 'P'
BusyBox v1.01 (2024.02.19-03:31+0000) multi-call binary

Usage: df [-hmkc] [FILESYSTEM ...]

Print the filesystem space used and space available.

Options:
        -c      correct formatting error

        -h      print sizes in human readable format (e.g., 1K 243M 2G )
        -m      print sizes in megabytes
        -k      print sizes in kilobytes(default)

EDIT:
Just tested and any call to the readlink function results in that output on my NAS, even if there’s no symlinks involved. I created a test script at /root/test.sh and was able to replicate the output. Seems there’s something different about my NAS than the one you’re using to test. Happy to get you creds on Wireguard to let you poke around if you want.

You’re the first person who’s ever reported a problem with the tool on QNAP which can’t be recreated.

[~] # df --help
df: invalid option -- '-'
df: unrecognized option '--help'
BusyBox v1.24.1 (2024-02-19 11:30:54 CST) multi-call binary.

Usage: df [-PkmhTai] [-B SIZE] [FILESYSTEM]...

Print filesystem usage statistics

	-P	POSIX output format
	-k	1024-byte blocks (default)
	-m	1M-byte blocks
	-h	Human readable (e.g. 1K 243M 2G)
	-T	Print filesystem type
	-a	Show all filesystems
	-i	Inodes
	-B SIZE	Blocksize
[~] # cat /etc/os-release 
NAME="QTS"
VERSION="5.1.5 (20240219)"
ID=qts
PRETTY_NAME="QTS 5.1.5 (20240219)"
VERSION_ID="5.1.5"
[~] # which df
/bin/df
[~] # date
Sun Mar 24 16:12:01 EDT 2024
[~] # 

CLEARLY, the version of BusyBox does not match

QNAP make a mistake?

(Checked both TVS-1282-i7 and TS-128A – they match)

Yeah I don’t even have an /etc/os-release or anything matching “release” in it. Which df/date show the same output adjusted for timezone, but definitely a different version of BB.

Having the antiquated version of BusyBox explains why df doesn’t work.

If you look at plex.sh, there’s a LOT of stuff I do in the shell.

PMS is expecting QTS 4.3 and above. BusyBox 1.01 is pushing 15+ years old now.
This must be an error in their build system.

From the BusyBox downloads page

[   ] busybox-1.00.tar.bz2    2004-10-13 09:49  1.1M  
[   ] busybox-1.00.tar.bz2..> 2004-10-13 09:49  552   
[   ] busybox-1.01.tar.bz2    2005-08-17 01:32  932K  
[   ] busybox-1.01.tar.bz2..> 2005-08-17 01:32  552   
[   ] busybox-1.1.0.tar.bz2   2006-01-14 07:15  1.3M  
[   ] busybox-1.1.0.tar.bz..> 2006-01-14 07:15  555   
[   ] busybox-1.1.1.tar.bz2   2006-03-22 21:20  1.4M  

For when you chat with QNAP

So while I’m pursuing that, any idea based on the logs what changed recently to cause Plex to leak memory all the time?

The tool did appear to work when i ran it with df -m, so maybe that will help…

Memory leaks –

  1. The DLNA server is a known memory leaker which they’ve never been able to solve. (It’s disabled by default for that reason. Daily restart is the only cure)

  2. Heavy uses of memory, which will cause QTS to kill the pids can come from:
    – Intro detection
    – Credit detection
    – Transcoder temp directory being set to /tmp and then running out of space.

There has been a great deal of work done to the scanner recently.
Is it possible? YEP

I’ll get started on a session where I monitor memory usage while building a new library

I just heard back from QNAP via their community forum:

Unfortunately, this is normal. The BusyBox version is linked to the NAS model, not the firmware version. Older models have older BusyBox versions.

If I can be of any assistance with testing lmk, happy to contribute!

I built up a whole server (about 15,000 files worth) on my 1 GB RAM TS-128A.
Intro and Credit detection are still running (it will take a while on the machine) but so far I have no indication of failure

This is going to be a weird problem to solve.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.