-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple files upload hangs the process in a blazor server app #47301
Comments
Thanks for reaching out, @sabrite. Could you please provide server-side logs to help us determine what's going on here (preferably trace-level) ASP.NET Core Logging and provide the logs from when the issue occurs? |
Hi @sabrite. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Thanks @MackinnonBuck - There is nothing in the logs whatsoever. The only thing that is recorded by Blazor Server app is the http request it is sending to the API. I cant see anything with tracing enabled and even using IntelliTrace. I have created a repo with bare minimum code. You should be able to reproduce this by "Uploading 3 or more files, each of 2MB or more". Here is the repo https://github.com/sabrite/BlazorFileUpload I will look forward to your inputs. Thanks, |
@SteveSandersonMS @danroth27 can someone please look into this? |
I've tracked this down to a defect in the backpressure mechanism with JS streams. WorkaroundOne workaround is simply to read the whole file into a Another workaround is to change the SignalR ReasonThe backpressure mechanism is having a
The problem goes away if SignalR accepts 2 concurrent calls within the circuit, because even though the write call for stream B is blocked, the JS side is still trying to do writes for stream A, so that never runs out of data. And then once the .NET side has finished reading A, it starts reading B, so everything continues and completes. SolutionWe need to change the backpressure mechanism so that, if the .NET side is unable to write to the pipe due to backpressure, then instead of awaiting, it should reject the write instantly and return a message to the JS side saying the write was rejected due to backpressure and it has to try again later. The JS side should then wait for a short period (say, 1 second, or maybe some exponential backoff with a max of 10 seconds or so) before trying again. This way, the circuit will never have any long-pending async operations due to backpressure. |
@mkArtakMSFT Removing my assignment now the investigation is done. This is definitely a bug. |
Thank you @SteveSandersonMS - much appreciated. Since no one responded for almost a month, my work around was to use MemoryStream like this and it always worked irrespective of the number and size of individual/all files (and now I know the reason why it works :) In my particular case, the user could upload N number of images of size < 300MB, so its hard to set Thanks again. |
Thanks for contacting us. We're moving this issue to the |
This error still occures in .NET 8, solution provided by @sabrite is what we are trying to avoid, because we expect that client can upload up to 50MB and in this scenario, 50MB will be loaded into |
The error still occurs in .NET 9 |
Is there an existing issue for this?
Describe the bug
I have a Blazor Server app which is calling an API to upload multiple images. With, one or more images selected using InputFile control, it always works:
And it doesnt work:
Here is the code for anyone who wants to quickly reproduce the issue:
Index.Razor
and here is the controller:
and in the Blazor Server project, tried this:
Nothing seems to work. Not sure it is a bug or I am missing something very obvious. I appreciate any help. Thanks,
Expected Behavior
All files should be successfully posted to backend API, no matter what the size of each file is.
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
.NET 7
Anything else?
No response
The text was updated successfully, but these errors were encountered: