What the hell is Plex Media Scanner doing on music?

Server Version#: 1.29.2.6364
Player Version#: 4.87.2

I’ve noticed that when adding a lot of music, Plex Media Scanner is stuck on 100% CPU for a long time, and memory usage can get really high–to the point where systemd was killing and restarting PMS because of OOM.

So to test, I added 60 cds worth of music, which had 1219 tracks, totaling 16.8 gB in flac. All of those tracks were already filtered through MusicBrainz Picard, so the metadata on them should be been in good shape.

And yet, Plex Media Scanner took nearly 5 hours to finish. This ps output was within 1 minute of it exiting.

USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
plex      528020  0.0  6.8 634004 571732 ?       RNl  14:47 288:23 /usr/lib/plexmediaserver/Plex Media Scanner --match --type 8 --log-file-suffix  Matcher --files @/tmp/3f46-f9d6-67bc-edc6.txt                                                

It used a maximum of ~3.5 gb of ram, before dropping down ~15 mins before exiting:

USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND      
plex      528020  0.0 42.7 3646984 3584432 ?     RNl  14:47 274:10 /usr/lib/plexmediaserver/Plex Media Scanner --match --type 8 --log-file-suffix  Matcher --files @/tmp/3f46-f9d6-67bc-edc6.txt                                                

All of the media was from NFS, so I could watch the network usage to get an idea of what’s being read. I watched the network usage and it only pulled 1-2 mB/s for the first 5-10 secs at the start of the scan, then dropped down to single digit kB/s the rest of the time–the same as would be used if nothing was going on, and it was just driving the terminal I was watching from.

So what the hell is that process doing? It’s working with at most 20 mB worth of metadata, and somehow it needs 5 hours and 3.5 gB of ram to do so? Whatever it is, it seems to be extremely inefficient.

PS. the web client also reports the wrong album being worked on while it’s stuck doing whatever the scanner was doing during that time–according to the files listed in that /tmp/file.

Are you putting all your music into one common folder? Or is there a proper folder structure by AlbumArtist and Album?
Are there albums with several dozens of discs among the collection?
Do you have loudness analysis and/or sonic analysis enabled to be performed right at a library scan?

There is a proper folder structure, but in this case, all the discs were part of the same album–a large collection of Bach.

Those analyses are enabled, but that’s not what’s going on given the small amount of network usage, it couldn’t possibly be working on the actual music content. And as a matter of fact, the Sonic Analysis is going on at the moment, in a separate process, using much less ram and cpu, and bottlenecking on the network read speed.

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