Plex Linux 1.31.2.6739 constantly scanning

I’ve been running Plex server on Linux for ~three years and I’ve had no issues at all, it’s been as smooth as butter.

Then for the last week or so (roughly since the version of Plex that had credits scanning, which I originally had turned on) Plex has been scanning my files constantly, in the Alerts panel I see the same folders come up over and over again.

I have moved and renamed some files recently but Plex has recognised this. I have turned off the options listed below which should stop it doing any background scanning unless a new file is added, and the scanning is also happening outside the Plex task scheduling hours. I don’t have any background tasks that would be changing my folders, nothing else has changed on the server.

If anyone has any ideas or things I can check please let me know, there’s no point having Plex spinning my HDs all day (it’s quite a large library) for no reason.

On:
Scan my library automatically
Run a partial scan when changes are detected
Run tasks at a lower priority
Intro video markers (scheduled and added)
Chapter thumbnails (scheduled and added)

Off
x Credit checking (never)
x Scan my library periodically
x Library scan interval (daily)
x Empty trash automatically after every scan
x Video preview thumbs (never)
x Credits videos markers (never)
x Refresh local metadata every three days
x Update all libraries during maintenance
x Upgrade media analysis during maintenance
x Refresh library metadata periodically
x Perform extensive media analysis during maintenance

OS: Linux Mint
Server Version#: 1.31.2.6739
Player Version#: n/a

Credit and Intro detection are enabled by default.

Go turn it off and restart (Under each section - Advanced - scroll to the bottom)

Those take a lot of time to process so the server will look active

Thanks for the reply.

Credit detection is off and has been since it was introduced as I saw my CPU spiking to 100% while that was processing.

Intros detection has been on for as long as I can remember and I’ve not had this issue before. Also, if that is the cause of the issue, why would Plex be rescanning the same folders for hours and days?

I have already restarted the server quite a few times over the past week, each time hoping this would fix itself. A scan always starts after some time. It says in the Alerts tab that it’s scanning, but almost never that any action is being taken.

And a scan is no bad thing. I don’t mind scans being done, but it’s never repeated itself like this before on files that haven’t changed.

I thought I had logs on but it turns out I only had player logs on, not server, so I’ll look at the new logs in a bit. There are some 35k files that it keeps scanning, so it’ll be busy.

It’s two days later and this is still happening. I’ve turned off everything to do with daily scanning, or downloading metadata every 3 days etc. I’ve kept “Scan my library automatically” + “Run a partial scan when changes are detected” turned on else I’d never see any new files in Plex at all. And yet Plex is still scanning my folders for hours, outside of the allowed task hours. This is a local HDD, not a NAS etc. Just a standard PC box with standard parts. It’s been fine for years, now it isn’t.

It feels like there’s a bug where “Run a partial scan when changes are detected” is firing, but then Plex decides to scan my entire system anyway – and with the number of files I have, that is taking hours for no actual effect because it’s scanning but not actually doing anything.

Logs available to those that want them, I’ve looked but I can’t tell what’s causing the system scan.

IMO build 1.31.2.6739 has introduced significant performance degradation with the agent/scanner from the small amount of testing I’ve had time to do.

Prior to build 1.31.2.6739 a scan (when no media is added/removed or changed) would take approx 90 seconds. I have a 3657 movies, 31890 episodes and 80612 tracks.

With this build 1.31.2.6739 its taking over 15 minutes for the same scan.

If I had to guess one of these two items has caused this …

  • (TV) Add series- and season-level preferences controlling audio and subtitle stream selection (#8036)
  • (Scanner) TV episodes with certain naming formats involving underscores could fail to be scanned in (#14111)

Over the weekend I plan on doing some more in dept testing comparing 1.31.2.6739 and 1.31.1.6733 scan times. I’ll update this thread once I’ve had the time to do it.

1 Like

This cannot be normal. “TV” is the name of the library. It is set to look at 59 root folders, any of which will hold TV show folders. All files in these folders are named in ways Plex understands and has had no problem with for years, although the folder structure is new. Originally I had one big parent folder with 400+ show folders, now I’ve split them out alphabetically over two drives).

And now I have pages and pages of this.

Credits and Intro checking is disabled now, thanks to this issue. 3-day scanning and metadata retrieval is turned off. Daily library scanning is turned off. Tasks should end at 0900. And this is going on for hours and hours and hours, with maybe a short break and then it starts again.

If I add one file, it goes off on a whole long scan of that whole series. “Scan my library automatically + Run a partial scan when changes are detected” are ticked but I think that last option isn’t being recognised.

This is still happening on v 1.31.2.6783. Is there a Plex expert or dev who might like to explain why Plex keeps rescanning the top level, and folders and files that haven’t changed?

Do you have a script that sets permissions on your files via cron?

Oh, interesting!.. I do have one that sets permissions after a torrent has auto downloaded, something I wrote some years ago but looking at it now its scope is a bit wide. So I’ll turn that off and report back if it makes a difference.

However… this scanning hasn’t been an issue up until this month, and it wouldn’t affect 99.99% of my files per run because their permissions wouldn’t change. It also wouldn’t explain why the scan looks in a show folder, then scans the root, then another show folder, then the root, then the first show folder again, taking hours.

Of course I never paid attention to how scanning was working before, and the idea of reinstalling Plex (and losing all the played data for my users etc for ~24TB) just to be able to compare console/alerts is not appealing!

I’ve been teaching folks that if they want to ‘scan’ for permissions.

find /directory-top -type d \! -perm 0755 -exec chmod 755 {} \;
find /directory-top -type f \! -perm 0644 -exec chmod 644 {} \;

Now it will scan and change only those files and directories not matching the permissions you want them to have versus using the sledgehammer technique.

That’s helpful, thankyou :slight_smile:

I’ve turned off the script I mentioned earlier but Plex is in the middle of a scan (of course) so I’ll have to wait until that’s finished to see if there’s any change in the scan trigger.

There’s still the scan behaviour of course. Is it worth me setting the debug logs to verbose to see what’s kicking off the scan and why there are reams of log entries like in the attached picture?

I don’t know what I’m looking at here but were I to guess…

Those are database queries hammering the database in rapid succession.

I don’t know where they’re coming from because Linux will have [DEBUG] in each statement.

Well, I turned off the permissions script I mentioned before, and today I’m seeing Plex scanning for four hours and counting.

– “because Linux will have [DEBUG]”
When I switch the listing to “raw” mode you see the word “debug” but nothing else is different eg "Mar 13, 2023 03:38:24.824 [0x7f4e067efb38] Debug — It took 0.000000 ms to retrieve 472 items."

Plex is not respecting the “Run a partial scan when changes are detected” flag, instead it’s thrashing my server for hours on end, bumping the CPU from the usual ~5% to 50% or higher and keeping the disks spinning for hours when they only need to be spinning when someone is using the system.

I honestly don’t understand why a dev hasn’t asked for logs yet unless this is a users-help-users forum, in which case what’s the point in reporting bugs if they’re never acknowledged by devs?

Server DEBUG logs ZIP please?

Something is triggering it.

My servers (4) sit quietly after new media is found and added… It’s surgical.

If you have anything changing permissions or anything writing in directories which are monitored, it’s going to scan.

Let me see the logs please One line doesn’t allow resolving it.

Plex Media Server Logs_2023-03-14_03-57-39.zip (4.6 MB)

I had to wait until the issue happened again, and here we are.

My torrenting app downloaded some files which were automatically moved into a folder that is monitored by my Torrents library and no other library. This folder is not inside any other monitored folder. The files were moved at 01:22am, and this triggered a scan of not just the folder affected, or just the library affected, but I think every folder in every library but definitely my TV library (the console panel is not an easy tool to use if you ever close the window). The scan ended at 03:54, so basically 2.5 hours to scan some 23.4k files of which only ~90 files were new.

GENERAL LIBRARY page settings:

“Scan my library automatically" + "Run a partial scan when changes are detected” are ON.

“Empty trash automatically after every scan” is ON.

“Run scanner tasks at a lower priority” is ON.

“Marker source” is “both”.

“Generate intro video markers” is “scheduled + when added” BUT this is turned off for the Torrents library.

“Generate chapter thumbnails” is “scheduled + when added”

Everything else on the Library page is turned off.

LIBRARY settings panel:

“Enable video preview thumbnails” is OFF.

SCHEDULED TASKS page settings:

Tasks can run from 2100 to 0900.

“Backup database” every 3 days is ON

“Optimize database”, “Remove old bundles”, “Remove old cache files” are ON

Everything else is off, which is painful as it means I don’t get updated metadata etc and media analysis but I want to get to the bottom of this before I dare turn more scanning operations on.

Other relevant services on this machine are Tautulli and Sonarr.

If I’ve done something silly then tell me and I’ll put my hands up, but I can’t see that I have done anything unusual or different to past months. I’m going to install a new HD over the weekend so files in the TV library aren’t split over two HDDs but that shouldn’t be the problem here.

NOTE: It’s a damn good thing I CTRL-copied this message before attaching the upload because attaching an upload wipes out the entire message. You might want to look into that.

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