Network use on import

Network traffic peaks at full utilization for minutes after importing a new episode. This only started happening in the recent update. I have ‘Analyse video files’ off so the files should simply be moved and renamed.

From the debug logs, it looks like Sonarr is trying to analyse the files which seems to take up to 5 mins depending on the size.

What happened in the latest version to cause this issue?

Which OS?
If non-Windows, which version of mono?
How many files?
What large are the files?
What is the speed of the network? (if its to a remote location, whats the internet speed)

Sonarr has always analyzed the video files when importing from your download client (regardless of that setting), it does this to weed out sample files as there isn’t a more reliable way to detect them. We changed how those files are accessed in the recent update to eliminate issues with unicode characters in the file name.

Windows 8.1 running Sonarr accessing a network share over 100mbit.

Files range from 500-1500MB, time ranges from 2-5 minutes. Pretty much the same amount of time it would take to copy the file over the network.

Is there any way I can roll-back to the version prior to the update?

You could download, restore the backup, but Sonarr would just update again in 6 hours.

@Taloth would appreciate your thoughts on this one, any chance we’re reading the entire file?

Thank you once again for the reply :wink:

It definitely sounds like Sonarr may be reading the entire file. I will keep watching it and await any other replies.

It would help to know which kind of files. MediaInfo will spend quite some bandwidth on .avi files, but way less on .mkv.

Sonarr only reads the portions of the file that was actually requested by MediaInfo, so it should only read a fraction of each file.
I’ll see if I can whip up some code to log at Trace how much it actually fetches per file.

I have only been using .mkv and .mp4 files. Any ideas when this will be fixed?

No, we haven’t even reproduced it yet.

EDIT: After some more testing, it seems to only be MP4 files that are creating excess network traffic and it is happening while the mediainfo is scanning the files. MKVs seem to be fine.

Had some time to look into this. Applied a fix to the develop branch, can’t say when it will get into master.

This should make you happy:

Before Fix:
[Debug] [32] VideoFileInfoReader: Getting media info from Z:\import\test\abc.avi 
[Trace] [32] MediaInfo: Read file offset 0-16384 (16384 bytes) 
[Trace] [32] MediaInfo: Read file offset 362119990-364980224 (2860234 bytes) 
[Trace] [32] MediaInfo: Read file offset 10252-364980224 (364969972 bytes) 
[Trace] [32] MediaInfo: Read a total of 367846590 bytes (100,8%) 

[Debug] [32] VideoFileInfoReader: Getting media info from Z:\import\test\abc.mp4 
[Trace] [32] MediaInfo: Read file offset 0-704512 (704512 bytes) 
[Trace] [32] MediaInfo: Read file offset 225495035-225495090 (55 bytes) 
[Trace] [32] MediaInfo: Read file offset 694134-225495090 (224800956 bytes) 
[Trace] [32] MediaInfo: Read a total of 225505523 bytes (100,0%) 

[Debug] [32] VideoFileInfoReader: Getting media info from Z:\import\test\abc.mkv 
[Trace] [32] MediaInfo: Read file offset 0-31293440 (31293440 bytes) 
[Trace] [32] MediaInfo: Read file offset 823128268-823149722 (21454 bytes) 
[Trace] [32] MediaInfo: Read a total of 31314894 bytes (3,8%) 

After Fix:
[Debug] [30] VideoFileInfoReader: Getting media info from Z:\import\test\abc.avi 
[Trace] [30] MediaInfo: Read file offset 0-16384 (16384 bytes) 
[Trace] [30] MediaInfo: Read file offset 362119990-364980224 (2860234 bytes) 
[Trace] [30] MediaInfo: Read file offset 10252-501772 (491520 bytes) 
[Trace] [30] MediaInfo: Read a total of 3368138 bytes (0,9%) 

[Debug] [30] VideoFileInfoReader: Getting media info from Z:\import\test\abc.mp4 
[Trace] [30] MediaInfo: Read file offset 0-704512 (704512 bytes) 
[Trace] [30] MediaInfo: Read file offset 225495035-225495090 (55 bytes) 
[Trace] [30] MediaInfo: Read file offset 694134-726902 (32768 bytes) 
[Trace] [30] MediaInfo: Read a total of 737335 bytes (0,3%) 

[Debug] [30] VideoFileInfoReader: Getting media info from Z:\import\test\abc.mkv 
[Trace] [30] MediaInfo: Read file offset 0-31293440 (31293440 bytes) 
[Trace] [30] MediaInfo: Read file offset 823128268-823144652 (16384 bytes) 
[Trace] [30] MediaInfo: Read a total of 31309824 bytes (3,8%) 

Optimized (Speed 0.0):
[Debug] [30] VideoFileInfoReader: Getting media info from Z:\import\test\abc.avi 
[Trace] [30] MediaInfo: Read file offset 0-16384 (16384 bytes) 
[Trace] [30] MediaInfo: Read file offset 362119990-364980224 (2860234 bytes) 
[Trace] [30] MediaInfo: Read file offset 10252-501772 (491520 bytes) 
[Trace] [30] MediaInfo: Read a total of 3368138 bytes (0,9%) 

[Debug] [30] VideoFileInfoReader: Getting media info from Z:\import\test\abc.mp4 
[Trace] [30] MediaInfo: Read file offset 0-704512 (704512 bytes) 
[Trace] [30] MediaInfo: Read file offset 225495035-225495090 (55 bytes) 
[Trace] [30] MediaInfo: Read file offset 694134-726902 (32768 bytes) 
[Trace] [30] MediaInfo: Read a total of 737335 bytes (0,3%) 

[Debug] [30] VideoFileInfoReader: Getting media info from Z:\import\test\abc.mkv 
[Trace] [30] MediaInfo: Read file offset 0-32768 (32768 bytes) 
[Trace] [30] MediaInfo: Read file offset 823128268-823144652 (16384 bytes) 
[Trace] [30] MediaInfo: Read a total of 49152 bytes (0,0%)

Thank you very much for your extended help. This is very much appreciated :wink:

I just witnessed a similar issue, network traffic spiked as if it were copying files over the network but these were .mkv files.