-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
BrowserHttpHandler can't stream large responses even with SetBrowserResponseStreamingEnabled #60287
Comments
Tagging subscribers to this area: @dotnet/ncl Issue DetailsDescriptionOn WebAssembly,
or
This was originally reported at dotnet/aspnetcore#36872 Reproduction StepsUsing code like the following on WebAssembly: using var response = await HttpClient.GetAsync(someUrl));
using var stream = response.Content.ReadAsStream(); ... it's possible to get a I think the underlying problem is this code: runtime/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/BrowserHttpHandler.cs Lines 429 to 433 in dc2d0cc
Instead of making an actual stream backed by the JS-side Expected behaviorShould be possible to read from arbitrary-sized response streams, assuming the developer doesn't choose to read it all into memory at once. Actual behaviorCrashes with errors like
or
Regression?No Known WorkaroundsNone ConfigurationBlazor WebAssembly on SDK 6.0.100-rtm.21508.19, any browser Other informationReal customer issue: dotnet/aspnetcore#36872
|
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsDescriptionOn WebAssembly,
or
This was originally reported at dotnet/aspnetcore#36872 Reproduction StepsUsing code like the following on WebAssembly: using var response = await HttpClient.GetAsync(someUrl);
using var stream = response.Content.ReadAsStream(); ... it's possible to get a I think the underlying problem is this code: runtime/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/BrowserHttpHandler.cs Lines 429 to 433 in dc2d0cc
Instead of making an actual stream backed by the JS-side Expected behaviorShould be possible to read from arbitrary-sized response streams, assuming the developer doesn't choose to read it all into memory at once. Actual behaviorCrashes with errors like
or
Regression?No Known WorkaroundsNone ConfigurationBlazor WebAssembly on SDK 6.0.100-rtm.21508.19, any browser Other informationReal customer issue: dotnet/aspnetcore#36872
|
You can enable response streaming by using: And in the runtime/src/libraries/System.Net.Http/src/System/Net/Http/BrowserHttpHandler/BrowserHttpHandler.cs Lines 275 to 283 in dc2d0cc
|
@campersau Thanks - I had forgotten about that API. Unfortunately after trying it, it still seems not to work. I've update this issue description to cover that. If you think I'm still doing something wrong please let me know! |
In order to be able to use |
^^ FYI @ylr-research |
I'll try that |
@pavelsavara thanks so much for the suggestion. @SteveSandersonMS thanks for following up on this issue. I was able to successfully download the file with both
On the other hand, same file using |
This can be closed |
Description
On WebAssembly,
HttpClient.SendAsync
can't handle large responses (e.g., > 1GB) and fails with errors likewhile also logging an absolutely giant stack trace (many screens high, dozens or maybe hundreds) starting with stuff like this:
This was originally reported at dotnet/aspnetcore#36872
Reproduction Steps
Using code like the following on WebAssembly:
... it's possible to get a
Stream
representing the body of an HTTP response, as long as it's pretty small. For larger responses (tested with 1 GB), it fails with the above error.Note that I also tried without
SetBrowserResponseStreamingEnabled
, and it also crashed, but with the same error (Uncaught (in promise) ExitStatus {name: 'ExitStatus', message: 'Program terminated with exit(0)', status: 0}
but without the giant stack trace.Expected behavior
Should be possible to read from arbitrary-sized response streams, assuming the developer doesn't choose to read it all into memory at once.
Actual behavior
Crashes as described above
Regression?
Don't know
Known Workarounds
None
Configuration
Blazor WebAssembly on SDK 6.0.100-rtm.21508.19, any browser
Other information
Based on real customer issue: dotnet/aspnetcore#36872
The text was updated successfully, but these errors were encountered: