SteveSandersonMS / BlazorInputFile

A file input component for Blazor applications
251 stars 75 forks source link

Stopped working after load ~20MB in total #17

Open AlfredBauer opened 4 years ago

AlfredBauer commented 4 years ago

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
KrisDoyle commented 4 years ago

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 commented 4 years ago

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:

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

iberisoft commented 4 years ago

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

azurl2 commented 4 years ago

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.

JHNBOS commented 4 years ago

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

cyberdarius commented 4 years ago

Same situation

JHNBOS commented 4 years ago

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

arvindram11 commented 4 years ago

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 commented 4 years ago

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.

tomaszmalik commented 4 years ago

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

gzipped commented 3 years ago

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