Adding a new TV to Plex corrupts the SQLite db


Recommended Posts

I've been facing an issue where my com.plexapp.plugins.library.db DB corrupts.  I've narrowed it down with this repro:

  • Download a new TV show
  • Place it in my TV media directory
  • Plex will notice a new show was added and start to add it to my Plex library
  • The DB will corrupt

I then need to restore my db files from the previous days backup.  I then click "Scan Library Files" in Plex to find the missing TV show, it finds and adds it without issue. 

Things work great until it automatically finds new media.

This is how I restore:

DATE="2019-06-01"
rm -f com.plexapp.plugins.library.db-shm
rm -f com.plexapp.plugins.library.db-wal
rm -f com.plexapp.plugins.library.blobs.db
rm -f com.plexapp.plugins.library.db
cp com.plexapp.plugins.library.blobs.db-$DATE  com.plexapp.plugins.library.blobs.db
cp com.plexapp.plugins.library.db-$DATE com.plexapp.plugins.library.db

Anyone have any idea of what could be going on?

I've tried changing my config directory from /mnt/user/appdata/plex to /mnt/user/cache/plex and that causes 100% corruption 100% of the time. I can't even get Plex to start when I point at /mnt/user/cache/plex.

 

I've ran SMART on the disk that contains the DB and there are no errors.

I run a VM on the SSD cache drive and have no issues.

My cache drive (SSD) has this SMART self-test history:

 

Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Vendor (0x60)       Completed without error       00%      4108         -
# 2  Offline             Completed without error       00%         0         -
# 3  Offline             Completed without error       00%         0         -
# 4  Offline             Completed without error       00%         0         -
# 5  Vendor (0x54)       Completed without error       00%         0         -
# 6  Vendor (0xb3)       Unknown status (0xe)          60%       211         -
# 7  Vendor (0x9d)       Unknown status (0xe)          50%     57544         -
# 8  Vendor (0xa5)       Unknown status (0xe)          50%     57032         -
# 9  Offline             Completed without error       00%         0         -
#10  Offline             Completed without error       00%        64         -
#11  Offline             Completed without error       00%         0         -
#12  Offline             Completed without error       00%         0         -
#13  Offline             Completed without error       00%         0         -

 

And this SMART error log:

Warning: ATA error count 2830 inconsistent with error log pointer 4

ATA Error Count: 2830 (device log contains only the most recent five errors)
	CR = Command Register [HEX]
	FR = Features Register [HEX]
	SC = Sector Count Register [HEX]
	SN = Sector Number Register [HEX]
	CL = Cylinder Low Register [HEX]
	CH = Cylinder High Register [HEX]
	DH = Device/Head Register [HEX]
	DC = Device Command Register [HEX]
	ER = Error register [HEX]
	ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It "wraps" after 49.710 days.

Error 2830 occurred at disk power-on lifetime: 37228 hours (1551 days + 4 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 c3 40 00 30 b3 01  Error: 

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ef 02 40 00 30 b3 01 60      00:00:15.776  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.776  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.760  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.760  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.745  SET FEATURES [Enable write cache]

Error 2829 occurred at disk power-on lifetime: 37228 hours (1551 days + 4 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 c3 40 00 30 b3 01  Error: 

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ef 02 40 00 30 b3 01 60      00:00:15.760  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.760  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.745  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.745  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.729  SET FEATURES [Enable write cache]

Error 2828 occurred at disk power-on lifetime: 37228 hours (1551 days + 4 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 c3 40 00 30 b3 01  Error: 

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ef 02 40 00 30 b3 01 60      00:00:15.745  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.745  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.729  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.729  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.714  SET FEATURES [Enable write cache]

Error 2827 occurred at disk power-on lifetime: 37228 hours (1551 days + 4 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 c3 40 00 30 b3 01  Error: 

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ef 02 40 00 30 b3 01 60      00:00:15.729  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.729  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.714  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.714  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.698  SET FEATURES [Enable write cache]

Error 2826 occurred at disk power-on lifetime: 37228 hours (1551 days + 4 hours)
  When the command that caused the error occurred, the device was active or idle.

  After command completion occurred, registers were:
  ER ST SC SN CL CH DH
  -- -- -- -- -- -- --
  40 c3 40 00 30 b3 01  Error: 

  Commands leading to the command that caused the error were:
  CR FR SC SN CL CH DH DC   Powered_Up_Time  Command/Feature_Name
  -- -- -- -- -- -- -- --  ----------------  --------------------
  ef 02 40 00 30 b3 01 60      00:00:15.714  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.714  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.698  SET FEATURES [Enable write cache]
  ef 02 00 00 30 b3 00 00      00:00:15.698  SET FEATURES [Enable write cache]
  ef 02 40 00 30 b3 01 60      00:00:15.682  SET FEATURES [Enable write cache]

 

Link to comment

It's /mnt/cache, not /mnt/user/cache.

The last still goes through the fuse system and might cause sqlite database corruption.

You do have a cache drive? If not, you need to move the plex appdata to on disk and use /mnt/diskX as that goes directly to disk the same way as using /mnt/cache.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.