-
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
FileUpload: Did not receive any data in the allotted time. #38842
Comments
This exception is raised in Blazor Server (here) when the client fails to send any data chunks within the stream for the SignalR Are you seeing the client send the stream data chunks within the Developer Tools > Network tab in the browser? Are you behind a VPN or proxy which may be restricting certain packets? If you can provide a public GitHub minimal repro application, it'll allow us to diagnose the issue further. |
Hi @Liero. 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. |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate. See our Issue Management Policies for more information. |
Im having the same issue when I upload big files to the server, it does not happen with small ones. |
This exception is raised in Blazor Server (here) when the client fails to send any data chunks within the stream for the SignalR Are you seeing the client send the stream data chunks within the Developer Tools > Network tab in the browser? Are you behind a VPN or proxy which may be restricting certain packets? If you can provide a public GitHub minimal repro application, it'll allow us to diagnose the issue further. |
Not happening anymore as far as I see! |
I don't have a repro, but we faced the same problem after upgrading Blazor server-side app from .NET5 to .NET6. We could read the stream immediately after calling Tried
WorkaroundRead and buffer the entire stream in We lose the benefit of streaming, but in our use case these were small files and an internal tool, so it was acceptable. NotesOne interesting symptom was that all button click event handlers stopped responding once this hang occurred, and even a page reload did not fix it. We had to restart the Blazor server to fix it. This page required being logged in, so it might be that this particular circuit had a deadlock of some sort. I really don't understand what was going on. |
@angularsen can you confirm if you're on Websockets (not long polling). You should see a warning message like this if you're using long polling. Also, could you please follow the debug steps/question in my original post: #38842 (comment) |
@TanayParikh Yes, we use websockets.
Yes, binary messages are listed on the If I select a 40 kB file, I see its binary message listed. I can then click upload and it succeeds. If I select 80 kB file, I see 3 chunked messages of ~32 kB with its contents. However, the UI now hangs and nothing happens and no additional binary messages are logged when I click the upload button, until it times out and crashes the app after 30 seconds. In my debugging, it seems reading from the file stream is the root cause. At this point, the blazor app has crashed and is no longer responding.
No.
I will try to find the time, but I can't promise anything. |
Thanks @angularsen, that's some great data. Is this a flaky issue, or is it 100% reproducible within your current application? If you haven't already, can you please increase your log levels to Debug/Verbose to ensure we can capture the most data. Setting
Thanks, this'll be optimal and ensure I'm able to appropriately investigate this issue. I'm re-opening this issue ticket. |
It is 100% consistent in our app. Thanks for reopening. |
@TanayParikh : I confirm that the symptoms described by @angularsen the same as we experienced. In my original post, the stream is opened fo reading in button click event callback, however I was not able to reproduce it. just found the exception in logs. I suspect that the key is the delay between Selecting the file and reading the stream |
Thanks for contacting us. |
Thanks for the details @andrzejczar84. Would you be able to put together a minimal, public, GitHub repo that reproduces the issue so I may take a look. Also could you provide the image at an external host (GitHub compresses the image pasted into md I believe). |
@TanayParikh here is the picture: https://imgur.com/a/q8L0jwj I'll try to reproduce the problem at the new minimal repo as fas as it's possible |
Can confirm that closing the steam solves the issue. |
I can confirm this too. Closing the stream solves a similar issue in my project too. Scenario: It was so frustrating to find the root cause because all my tests indicated problems with MudBlazor MudDialog or the CPU intensive work I was doing on the loaded data (WhisperNet. I had to change the library from Whisper.net to WhisperNet, now I feel sorry for blaming Whisper.net) Resolve |
Any news on this? Still happening when we try to upload multiple files. We do not use AutoFac. |
I run into the same issue when doing things parallel. |
@DontEatRice, would you be able to provide us with a repro that demonstrates the bug? The repro we've seen so far wasn't reading the stream to completion (see #38842 (comment)), and others using Autofac mentioned that #38842 (comment) resolved the issue for them. A repro that demonstrates a framework bug would be very valuable, so if you (or someone else) can provide a minimal repro that doesn't use third-party dependencies and is hosted as a public GitHub repository, that would be much appreciated. Thanks! |
I have created the repo that demonstrates this bug: https://github.com/DontEatRice/BlazorFileUploadIssue First run the Web Api in the Go to the After trying to upload them, Blazor will throw an exception after some time. In net7.0 the exception stack trace was longer, something happened, and in net8.0 it is quite short. Please message me if you have any questions. |
Thank you for the repro, @DontEatRice! It looks like this is exactly the same issue as #47301, and you can see a detailed explanation here that shows what's going on. The code in your repro can be modified slightly to make this work: +var memoryStream = new MemoryStream();
+var browserFileStream = file.OpenReadStream(maxAllowedSize: 15_000_000);
+await browserFileStream.CopyToAsync(memoryStream);
+memoryStream.Position = 0;
-var fileContent = new StreamContent(file.OpenReadStream(long.MaxValue));
+var fileContent = new StreamContent(memoryStream);
fileContent.Headers.ContentType = new MediaTypeHeaderValue(file.ContentType);
fileContent.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data") { Name = "\"Files\"", FileName = $"\"{file.Name}\"" };
content.Add(fileContent); Within this single GitHub issue, we've seen multiple causes of this exception:
So, it's not clear to me whether this issue tracks a unique framework bug. There's a lot of community activity here, but the root cause of the problem seems to vary widely. This probably indicates we should update our documentation to help developers diagnose this issue better. @guardrex, would you be able to add a section to the file upload docs that explain some of the common causes of this exception? Also, it looks like the sample in this section might be susceptible to this problem. If that's the case, could we update that sample to take an approach similar to what I wrote above (in the diff)? Thanks! |
@MackinnonBuck ... This one came in, too, which I was waiting to discuss around 🦃 Day. I'll mention this issue to that dev. |
I have a question about the code example. The documentation mentions that files shouldn't be copied in to a I've done this for my implementation and passed the stream from |
That's true in most cases, but in the repro provided by @DontEatRice, the reading of each stream is controlled by the implementation of Note that this workaround won't be required:
|
Ah, thank you. Guess I'll change this until that issue is resolved. |
I'm going to close this out now:
If others are experiencing this issue and the root cause is not one of those listed in this comment, please open a new issue with detailed reproduction steps and a minimal project that can be used to reproduce the issue (hosted as a public GitHub repository, not a zip file). Thanks! |
Has anyone been able to reproduce this in a BUnit test? |
Describe the bug
Not sure if this is a bug but I haven't found any documentation either.
IBrowserFile.ReportFile!.OpenReadStream(maxFileSize).CopyToAsync(fileStream);
sometimes throwsTo Reproduce
I haven't found a reliable way to reproduce the issue, since it happens only sometimes and have no idea what is causing it.
Here is the code:
Exceptions (if any)
System.TimeoutException: Did not receive any data in the allotted time.
``` [ { "method":"System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw", "level":0, "line":0, "assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, { "method":"System.IO.Pipelines.Pipe.GetReadResult", "level":1, "line":0, "assembly":"System.IO.Pipelines, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" }, { "method":"System.IO.Pipelines.Pipe.GetReadAsyncResult", "level":2, "line":0, "assembly":"System.IO.Pipelines, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" }, { "method":"System.IO.Pipelines.PipeReaderStream+d__30.MoveNext", "level":3, "line":0, "assembly":"System.IO.Pipelines, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" }, { "method":"System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw", "level":4, "line":0, "assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, { "method":"System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess", "level":5, "line":0, "assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, { "method":"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification", "level":6, "line":0, "assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, { "method":"Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSDataStream+d__36.MoveNext", "level":7, "line":0, "assembly":"Microsoft.AspNetCore.Components.Server, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" }, { "method":"System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw", "level":8, "line":0, "assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, { "method":"System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess", "level":9, "line":0, "assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, { "method":"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification", "level":10, "line":0, "assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, { "method":"Microsoft.AspNetCore.Components.Forms.BrowserFileStream+d__30.MoveNext", "level":11, "line":0, "assembly":"Microsoft.AspNetCore.Components.Web, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" }, { "method":"System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw", "level":12, "line":0, "assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, { "method":"System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess", "level":13, "line":0, "assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, { "method":"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification", "level":14, "line":0, "assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, { "method":"Microsoft.AspNetCore.Components.Forms.BrowserFileStream+d__28.MoveNext", "level":15, "line":0, "assembly":"Microsoft.AspNetCore.Components.Web, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60" }, { "method":"System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw", "level":16, "line":0, "assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, { "method":"System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess", "level":17, "line":0, "assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, { "method":"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification", "level":18, "line":0, "assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, { "method":"System.IO.Stream+<g__Core|29_0>d.MoveNext", "level":19, "line":0, "assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, { "method":"System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw", "level":20, "line":0, "assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, { "method":"System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess", "level":21, "line":0, "assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, { "method":"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification", "level":22, "line":0, "assembly":"System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e" }, { "method":"MyApp.Pages.MyPage+d__54.MoveNext", "level":23, "line":348, "assembly":"MyApp, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null", "fileName":"D:\\a\\1\\s\\src\\app\\Pages\\MyPage.razor.cs" } ] ```Further technical details
dotnet --info
:dotnet --info Output
The text was updated successfully, but these errors were encountered: