Plex Scanner hanging forever and consuming CPU after file not found error

Server Version#: 1.40.2.8395
Player Version#: 1.92.1.140-8e1f68f5

I am having an issue where the Plex library scanner will run forever and consume lots of resources after not being able to find a file (which exists). Here’s the last entries from the scanner in the logs:

May 09, 2024 14:54:46.836 [140258019150648] DEBUG - Scanner: Processing directory /media/music/Dead South, The (parent: yes)
May 09, 2024 14:54:46.838 [140258019150648] DEBUG - Skipping over directory 'Dead South, The', as nothing has changed; removing 0 media items from map.
May 09, 2024 14:54:46.839 [140258019150648] DEBUG - Scanner: Processing directory /media/music/Dead South, The/Chains & Stakes (2024) (parent: yes)
May 09, 2024 14:54:46.843 [140258019150648] DEBUG - File '/media/music/Dead South, The/Chains & Stakes (2024)/The Dead South - Chains & Stakes - 01 - Blood On The Mind.flac' didn't exist, can't skip.

After that the scanner just hangs forever consuming a full core on my server.

Oddly enough the file does exist:

❯ ls -al /tank/media/music/Dead\ South,\ The/Chains\ \&\ Stakes\ \(2024\)/
total 221565
drwxrwxr-x 2 nobody zfswrite       15 May  7 21:37  ./
drwxrwxr-x 6 nobody zfswrite        6 Mar 19 22:44  ../
-rwxrwxr-x 1 nobody zfswrite 21837137 Mar 19 21:45 'The Dead South - Chains & Stakes - 01 - Blood on the Mind.flac'*
-rwxrwxr-x 1 nobody zfswrite 15590702 Mar 19 21:45 'The Dead South - Chains & Stakes - 02 - Yours to Keep.flac'*
-rwxrwxr-x 1 nobody zfswrite  9690833 Mar 19 21:45 'The Dead South - Chains & Stakes - 03 - 20 Mile Jump.flac'*
-rwxrwxr-x 1 nobody zfswrite  5849754 Mar 19 21:44 'The Dead South - Chains & Stakes - 04 - Where Has the Time Gone.flac'*
-rwxrwxr-x 1 nobody zfswrite 25147739 Mar 19 21:44 'The Dead South - Chains & Stakes - 05 - A Little Devil.flac'*
-rwxrwxr-x 1 nobody zfswrite 24890643 Mar 19 21:44 'The Dead South - Chains & Stakes - 06 - Son of Ambrose.flac'*
-rwxrwxr-x 1 nobody zfswrite  6427613 Mar 19 21:44 'The Dead South - Chains & Stakes - 07 - Clemency.flac'*
-rwxrwxr-x 1 nobody zfswrite 24591987 Mar 19 21:45 'The Dead South - Chains & Stakes - 08 - Completely, Sweetly.flac'*
-rwxrwxr-x 1 nobody zfswrite 22878546 Mar 19 21:44 'The Dead South - Chains & Stakes - 09 - A Place I Hardly Know.flac'*
-rwxrwxr-x 1 nobody zfswrite 14974480 Mar 19 21:44 'The Dead South - Chains & Stakes - 10 - The Cured Contessa.flac'*
-rwxrwxr-x 1 nobody zfswrite 27385030 Mar 19 21:44 'The Dead South - Chains & Stakes - 11 - Tiny Wooden Box.flac'*
-rwxrwxr-x 1 nobody zfswrite  4099801 Mar 19 21:44 'The Dead South - Chains & Stakes - 12 - Yore.flac'*
-rwxrwxr-x 1 nobody zfswrite 23464774 Mar 19 21:45 'The Dead South - Chains & Stakes - 13 - Father John.flac'*

File permissions are identical to those of the rest of the media that doesn’t get the scanner stuck.

The scanner log doesn’t actually show anything from that song, it ends at the media right before it:

May 09, 2024 14:54:46.916 [140354986987264] DEBUG - [FFMPEG] - Opening '/media/music/Lucky Boys Confusion/Stormchasers (2017)/Lucky Boys Confusion - Stormchasers - 02 - It’s After Midnight.mp3' for reading
May 09, 2024 14:54:46.916 [140354986987264] DEBUG - [FFMPEG] - Setting default whitelist 'file,crypto,data'
May 09, 2024 14:54:46.927 [140354986987264] DEBUG - [FFMPEG] - Format mp3 probed with size=131072 and score=51
May 09, 2024 14:54:46.928 [140354986987264] DEBUG - [FFMPEG] - id3v2 ver:4 flags:80 len:116379

This issue is driving me nuts because when the scanner hangs it consumes A LOT of resources, and also doesn’t scan any libraries that are alphabetically after my music library, so they never get updated.

I also tried a complete fresh install of the plex server, and still got the same issue, so I don’t think it’s a corrupted database issue?

Any help would be greatly appreciated. Let me know if I can add any additional information.

Removing the offending file had it get stuck on another file in the same way:

May 09, 2024 15:10:25.887 [140442977168184] DEBUG - Scanner: Processing directory /media/music/Disturbed (parent: yes)
May 09, 2024 15:10:25.889 [140442977168184] DEBUG - Skipping over directory 'Disturbed', as nothing has changed; removing 0 media items from map.
May 09, 2024 15:10:25.889 [140442977168184] DEBUG - Scanner: Processing directory /media/music/Disturbed/Asylum (2010) (parent: yes)
May 09, 2024 15:10:25.893 [140442977168184] DEBUG - File '/media/music/Disturbed/Asylum (2010)/Disturbed - Asylum - 05 - Another Way To Die.flac' didn't exist, can't skip.

After removing that file, a new error:

May 09, 2024 15:16:33.218 [140216096197432] DEBUG - Scanner: Processing directory /media/music/Perfume/未来のミュージアム (2013) (parent: yes)
May 09, 2024 15:16:33.220 [140216096197432] DEBUG - File '/media/music/Perfume/未来のミュージアム (2013)/Perfume - 未来のミュージアム - 02 - だいじょばない.flac' changed size, can't skip.

Not sure who to reach out to here. I know @ChuckPa has helped me with issues in the past. Do you know who might be able to help me with this?

Also, here’s the full log files just in case that’s useful.
Plex Media Server Logs_2024-05-09_15-17-02.zip (1.2 MB)

What happened here? Is this where you removed the file mid scan?

I see a lot of playbacks start but this is the only one I see get to the transcoder .

May 09, 2024 14:45:49.497 [139909029079864] WARN - MDE: unable to find a working transcode profile for video stream
May 09, 2024 14:45:49.497 [139909029079864] DEBUG - Cleaning directory for session 9cfd0036-a04e-4d9e-b2eb-92a3fc5c1bf6 ()
May 09, 2024 14:45:49.497 [139909029079864] DEBUG - Starting a transcode session 9cfd0036-a04e-4d9e-b2eb-92a3fc5c1bf6 at offset -1.0 (state=3)
May 09, 2024 14:45:49.497 [139909029079864] DEBUG - Streaming Resource: Added session 0x7f3f20fb2678:9cfd0036-a04e-4d9e-b2eb-92a3fc5c1bf6
May 09, 2024 14:45:49.498 [139909029079864] DEBUG - [Universal] Using local file path instead of URL: /media/quarantine/Shangri-La Frontier (2023) [tvdb-421855]/Season 01/Shangri-La Frontier (2023) - S01E14 - 014 - Squish [v2 HDTV-1080p v2][10bit][x265][AAC 2.0][JA+EN]-Judas.mkv
May 09, 2024 14:45:49.498 [139909029079864] DEBUG - TPU: hardware transcoding: final decoder: , final encoder: 
May 09, 2024 14:45:49.498 [139909029079864] DEBUG - [JobRunner] Job running: FFMPEG_EXTERNAL_LIBS='/config/Library/Application\ Support/Plex\ Media\ Server/Codecs/ad47460-4673-linux-x86_64/' X_PLEX_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx "/usr/lib/plexmediaserver/Plex Transcoder" -codec:1 aac -analyzeduration 20000000 -probesize 20000000 -i "/media/quarantine/Shangri-La Frontier (2023) [tvdb-421855]/Season 01/Shangri-La Frontier (2023) - S01E14 - 014 - Squish [v2 HDTV-1080p v2][10bit][x265][AAC 2.0][JA+EN]-Judas.mkv" -filter_complex "[0:1] aresample=async=1:ochl='stereo':rematrix_maxval=0.000000dB:osr=44100[0]" -map "[0]" -metadata:s:0 language=jpn -codec:0 flac -b:0 4096k -f flac -map_metadata -1 -map_chapters -1 -t 715.65049999999997 /transcode/Transcode/Detection/b59b1422-f7fd-41d9-b234-ea6751dbed06 -map 0:3 -f null -codec ass nullfile -y -nostats -loglevel quiet -loglevel_plex error -progressurl http://127.0.0.1:32400/video/:/transcode/session/9cfd0036-a04e-4d9e-b2eb-92a3fc5c1bf6/97d10cb6-bdfb-45f6-896e-9709e1795e32/progress
May 09, 2024 14:45:49.498 [139909029079864] DEBUG - [JobRunner] In directory: "/transcode/Transcode/Sessions/plex-transcode-9cfd0036-a04e-4d9e-b2eb-92a3fc5c1bf6-97d10cb6-bdfb-45f6-896e-9709e1795e32"
May 09, 2024 14:45:49.498 [139909029079864] DEBUG - [JobRunner] Jobs: Starting child process with pid 923
May 09, 2024 14:45:49.501 [139908990774072] DEBUG - Request: [127.0.0.1:52088 (Loopback)] PUT /video/:/transcode/session/9cfd0036-a04e-4d9e-b2eb-92a3fc5c1bf6/97d10cb6-bdfb-45f6-896e-9709e1795e32/progress?status=startup (4 live) #3c25 Signed-in Token (cbc02009) (range: bytes=0-) 
May 09, 2024 14:45:49.502 [139909154437944] DEBUG - Completed: [127.0.0.1:52088] 204 PUT /video/:/transcode/session/9cfd0036-a04e-4d9e-b2eb-92a3fc5c1bf6/97d10cb6-bdfb-45f6-896e-9709e1795e32/progress?status=startup (4 live) #3c25 0ms 203 bytes (pipelined: 1) (range: bytes=0-) 
May 09, 2024 14:45:49.503 [139909106080568] DEBUG - Request: [127.0.0.1:52088 (Loopback)] PUT /video/:/transcode/session/9cfd0036-a04e-4d9e-b2eb-92a3fc5c1bf6/97d10cb6-bdfb-45f6-896e-9709e1795e32/progress?status=startup (4 live) #3c54 Signed-in Token (cbc02009) (range: bytes=0-) 

Have any of them actually worked ?

Nope, didn’t touch the file.

Not sure about the large number of playbacks, no one was actively playing anything during my testing that I noticed.

I haven’t had any issues with anything playing though. It’s just the scanner.

EDIT: just saw the playbacks in the logs. That’s like every video in my library over the course of a couple seconds. Not sure how that’s even possible…

Would you go look at your server access ?

Is it possible someone has your login credentials?

Looking at my login emails and authorized devices, I don’t see anything suspicious. I will change my password just in case, but I don’t think that’s the issue.

Is there somewhere else I can look for server access logs in plex?

@ChuckPa would it be useful to send someone the files causing the issue to see if they can replicate it?

@cbc02009

Now that my day is settling down… :rofl:

Yes, that makes perfect sense. See if I can replicate the problem.
If I can replicate then I know they will.

Would you like a PM for the link?

Yes please

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