BlazorInputFile
BlazorInputFile copied to clipboard
Stopped working after load ~20MB in total
Hello everyone. There's interesting problem, that has some similarities with this issue. Actually I think it's the same.
Reproduce:
- Choose multifile profile(no matter, single or multifile)
- Pick up 3 files. 12, 8 and 8 MB.
- Press download button. Initially load file 12MB(it's important), then 8 and 8.
- Load progress in % will be: 12MB - 100%, 8 - 100%, 8 - 6%.
- If you would be loading 8, 8 and 12 all will be okay, then you will try some other files and the problem will show itself again.
And you know why load was stopped at 6% in the example above? Cause the method CopyToAsync stopped at position 512000 while stream was read:
{ var ms = new MemoryStream(); await file.Data.CopyToAsync(ms); }
When you are going through the imaginary limit of ~20MB all subsequent reading will be stopped at position 512000.
Remark: Steve, let's be honest. I think, just think, that you know of this problem. In your gif example for multifile you are choosing three files: 19MB, 12MB and 30KB, but it was downloaded in vice versa. 30KB -> 12MB -> 19MB.
It would be appreciated to see some answers.
Environment:
- Windows 10 build 19028
- Server side
- Asp Net Core 3.0
Running into the same issue as the moment. One thing I've noticed, is that if I step through it line by line, it works for all files all the way to the end.
If I just let it run normally, it hangs after about the 10th file or so (which I suspect is around the limit) with an InvalidOperationException which might be a concurrency issue, not sure yet. Anyhow, still looking through it so if I come across anything interesting, I'll throw it in here :)
Quick update re: my comment about stepping through. So, if I put a breakpoint on line 65 of RemoteFileListEntryStream.cs, and then proceed to step through (it's a conditional break at sourceOffset > 30146559 with a file that's 30160627 bytes), the upload works. If I let it run normally, I get:
- Exception thrown: 'System.IO.EndOfStreamException' in Microsoft.AspNetCore.Components.Server.dll
- Exception thrown: 'System.IO.InvalidDataException' in Microsoft.AspNetCore.Components.Server.dll
- Exception thrown: 'System.IO.InvalidDataException' in Microsoft.AspNetCore.Components.Server.dll
...but I'm not sure which block it's failing on although I suspect it's the last one since it's trying to read past the end of the stream for some strange reason. It's almost like there's a race condition somewhere or it has trouble close to the end of the stream. Anyways, I'm continuing the troubleshoot.
I have the same issue: it hangs up after uploading 26 MB.
Does anyone have a solution for this? We are encountering this issue in our project here aswell, we need to be able to upload files up to and maybe beyond 160MB, it stops after around 20MB has been uploaded.
Has this issue been fixed? I am still experiencing the same issue.
Same situation
I eventually switched to Blazor.FileReader, with it I was able to overcome this issue.
Having the same issue. Stopped right around 20 MB (after about 23 or 24 files - each about 850 KB each). Has anyone found any workaround? Maybe something in input.js?
It is perhaps this line of code?
[Parameter] public int MaxMessageSize { get; set; } = 20 * 1024; // TODO: Use SignalR default
Edit: Probably not. Realized this is 20KB chunk and not 20MB as I initially thought.
@arvindram11
Changing from:
[Parameter] public int MaxBufferSize { get; set; } = 1024 * 1024;
to for example:
[Parameter] public int MaxBufferSize { get; set; } = 20 * 1024;
solves the problem, but I didn't look what is a real cause.
As workaround I lowered degree of parallelism by setting MaxBufferSize as follows:
<InputFile id="uploadFiles" multiple OnChange="HandleSelection" MaxBufferSize="@(20*1024)"/>