Random "Failed to connect to 127.0.0.1 port 32400: Address already in use" errors during scan

Server Version#: 1.18.0.1913

As shown in my “Plex Media Scanner.log” snippet below, I am getting many failed HTTP requests to 127.0.0.1:32400 during scans. There are no errors at the beginning of the log, then after the scan has been running for about a minute it starts to report these errors. I’ve been running Plex Media Sever on the same Win10 machine for the last few years without issues and all of a sudden I started having issues about a week ago. My scans will sometimes not add/remove items correctly and whenever this happens I always get the same error with HTTP connections to the 127.0.0.1:32400 as shown in the logs below. It is randomly occuring for the different HTTP requests that are made (and not just the status updates). I’ve tried going back to a database backup before the issue and also downgrading to 1.18.0.1913, but I still get the same errors in the log. I also tried clearing out the cache and that did not help either. I’ve spent many hours trying to figure this out, but I am getting nowhere. Any ideas?

Oct 27, 2019 13:30:32.752 [15544] DEBUG - Scanner: Processing directory D:\Video\Movies\Miami.Blues.1990.1080p.BluRay.X264 (parent: yes)
Oct 27, 2019 13:30:32.752 [15544] DEBUG - Skipping over directory 'Miami.Blues.1990.1080p.BluRay.X264', as nothing has changed; removing 1 media items from map.
Oct 27, 2019 13:30:32.768 [12048] DEBUG - HTTP requesting GET http://127.0.0.1:32400/:/metadata/updateProgressMessage?message=Scanning%20Miami%2EBlues%2E1990%2E1080p%2EBluRay%2EX264
Oct 27, 2019 13:30:32.768 [12048] ERROR - Error issuing curl_easy_perform(handle): 7
Oct 27, 2019 13:30:32.768 [12048] WARN - HTTP error requesting GET http://127.0.0.1:32400/:/metadata/updateProgressMessage?message=Scanning%20Miami%2EBlues%2E1990%2E1080p%2EBluRay%2EX264 (0, No error) (Failed to connect to 127.0.0.1 port 32400: Address already in use)
Oct 27, 2019 13:30:32.768 [15544] DEBUG - Scanner: Processing directory D:\Video\Movies\Miami.Blues.1990.1080p.BluRay.X264\Subs (parent: yes)
Oct 27, 2019 13:30:32.768 [15544] DEBUG - Skipping over directory 'Miami.Blues.1990.1080p.BluRay.X264\Subs', as nothing has changed; removing 0 media items from map.
Oct 27, 2019 13:30:32.768 [12048] DEBUG - HTTP requesting GET http://127.0.0.1:32400/:/metadata/updateProgressMessage?message=Scanning%20Miami%2EBlues%2E1990%2E1080p%2EBluRay%2EX264%5CSubs
Oct 27, 2019 13:30:32.768 [15544] DEBUG - HTTP requesting PUT http://127.0.0.1:32400/activities/8f99525e-42b5-4b24-84ad-41803f5beded?percentComplete=%2B0%2E00805152953&subtitle=Subs
Oct 27, 2019 13:30:32.783 [12048] ERROR - Error issuing curl_easy_perform(handle): 7
Oct 27, 2019 13:30:32.783 [15544] ERROR - Error issuing curl_easy_perform(handle): 7
Oct 27, 2019 13:30:32.783 [12048] WARN - HTTP error requesting GET http://127.0.0.1:32400/:/metadata/updateProgressMessage?message=Scanning%20Miami%2EBlues%2E1990%2E1080p%2EBluRay%2EX264%5CSubs (0, No error) (Failed to connect to 127.0.0.1 port 32400: Address already in use)
Oct 27, 2019 13:30:32.783 [15544] WARN - HTTP error requesting PUT http://127.0.0.1:32400/activities/8f99525e-42b5-4b24-84ad-41803f5beded?percentComplete=%2B0%2E00805152953&subtitle=Subs (0, No error) (Failed to connect to 127.0.0.1 port 32400: Address already in use)

It appears that I’m running into the same issue as the following post, netstat is showing thousands of connections to 127.0.0.1:32400 in TIME_WAIT state:

I’ve increased my ephemeral port limit and now the scan ran without errors. Is it normal for Plex to be creating so many lingering connections during scans?

I also decreased my Windows 10 TcpTimedWaitDelay OS setting (registry setting) to make the lingering connections go away faster.

It appears that both these settings (TCP port limit and TcpTimedWaitDelay) need to be adjusted when you have a large library, otherwise scans can fail.

HTTP keep-alive (connection reuse) should really be used for all these HTTP requests that happen rapidly during a scan, then we wouldn’t need to tweak the OS network settings to make things work with large libraries. It would also have the benefit improved scan performance for everyone. It’s possible it could reduce the time it takes for the scan by a noticable amount in addition to preventing the OS from ever running out of ports.

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