BlazorInputFile icon indicating copy to clipboard operation
BlazorInputFile copied to clipboard

Stopped working after load ~20MB in total

Open AlfredBauer opened this issue 5 years ago • 11 comments

Hello everyone. There's interesting problem, that has some similarities with this issue. Actually I think it's the same.

Reproduce:

  1. Choose multifile profile(no matter, single or multifile)
  2. Pick up 3 files. 12, 8 and 8 MB.
  3. Press download button. Initially load file 12MB(it's important), then 8 and 8.
  4. Load progress in % will be: 12MB - 100%, 8 - 100%, 8 - 6%.
  5. 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:

  1. Windows 10 build 19028
  2. Server side
  3. Asp Net Core 3.0

AlfredBauer avatar Nov 21 '19 14:11 AlfredBauer

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 :)

KrisDoyle avatar Dec 19 '19 14:12 KrisDoyle

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.

KrisDoyle avatar Dec 19 '19 20:12 KrisDoyle

I have the same issue: it hangs up after uploading 26 MB.

iberisoft avatar Dec 24 '19 11:12 iberisoft

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.

azurl2 avatar Feb 20 '20 14:02 azurl2

Has this issue been fixed? I am still experiencing the same issue.

JHNBOS avatar Apr 02 '20 11:04 JHNBOS

Same situation

cyberdarius avatar May 19 '20 13:05 cyberdarius

I eventually switched to Blazor.FileReader, with it I was able to overcome this issue.

JHNBOS avatar May 19 '20 14:05 JHNBOS

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?

arvindram11 avatar Jun 15 '20 01:06 arvindram11

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 avatar Jun 15 '20 12:06 arvindram11

@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.

tomaszmalik avatar Jul 09 '20 15:07 tomaszmalik

As workaround I lowered degree of parallelism by setting MaxBufferSize as follows: <InputFile id="uploadFiles" multiple OnChange="HandleSelection" MaxBufferSize="@(20*1024)"/>

gzipped avatar Sep 27 '20 19:09 gzipped