Skip to content
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

"body stream already read" error due to broken blazor wasm fallback #40547

Closed
kg opened this issue Mar 4, 2022 · 9 comments
Closed

"body stream already read" error due to broken blazor wasm fallback #40547

kg opened this issue Mar 4, 2022 · 9 comments
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly

Comments

@kg
Copy link

kg commented Mar 4, 2022

Right now if a streaming compile of the blazor wasm binary fails, we fall into a fallback path that won't actually work. It produces this error:

TypeError: Failed to execute 'arrayBuffer' on 'Response': body stream already read

This is because the first compile attempt already consumed the body of the response, and it can't be consumed a second time. The fix is to issue a second fetch before attempting to compile again. We would want to do that in the fallback path above here:

const arrayBuffer = await wasmResource.response.then(r => r.arrayBuffer());

We also currently just try to do a streaming compile, but the most common failure case is detectable without trying to compile - if the content-type of the response is not application/wasm the streaming compile will always fail, so we should probe for that (via response.headers.get("Content-Type")) and if it doesn't match we should just immediately jump to the fallback. This would eliminate the need for a 2nd fetch.

(The second fetch shouldn't be a performance issue anyway, it should hit the browser cache.)

cc @radical

@radical
Copy link
Member

radical commented Mar 4, 2022

An issue where this manifested - #40528

@radical
Copy link
Member

radical commented Mar 4, 2022

cc @pranavkm

@radical radical added the feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly label Mar 4, 2022
@TanayParikh TanayParikh added the area-blazor Includes: Blazor, Razor Components label Mar 4, 2022
@javiercn
Copy link
Member

javiercn commented Mar 7, 2022

Seems that the underlying issue is the OOM happening.

I'm closing this issue in favor of #40547

@javiercn javiercn closed this as completed Mar 7, 2022
@javiercn javiercn added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label Mar 7, 2022
@ghost ghost added the Status: Resolved label Mar 7, 2022
@TanayParikh
Copy link
Contributor

Re-opening as dotnet/runtime#95971 is more related to changing the error message.

@TanayParikh TanayParikh reopened this Mar 7, 2022
@TanayParikh TanayParikh removed ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved labels Mar 7, 2022
@mkArtakMSFT mkArtakMSFT added this to the .NET 7 Planning milestone Mar 7, 2022
@ghost
Copy link

ghost commented Mar 7, 2022

Thanks for contacting us.

We're moving this issue to the .NET 7 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@mkArtakMSFT mkArtakMSFT added bug This issue describes a behavior which is not expected - a bug. triaged labels Mar 23, 2022
@CoryKoehler
Copy link

CoryKoehler commented Mar 25, 2022

@danroth27 @SteveSandersonMS
Hello, I put in an issue similar and closed it since this one seems to be the one where everything is tracked regarding this.
I don't think this can be pushed to .Net7. I am having customers complain currently on this. Depending on device (both Android and IOS are affected)

This to me seems huge and would make my clients rethink any investment in Blazor.
An existing production site that is blazor wasm hosted that is having this issue is boatsforsale.com and replicate this issue with enough attempts on smaller devices. The site will display just a loading spinner forever and in the console you'll see
image

Is there any way this could be looked into for an earlier release than next nov?
@chassq

@SteveSandersonMS
Copy link
Member

@CoryKoehler I suspect this issue isn't your actual problem, and that dotnet/runtime#95971 is. We have an ongoing discussion with the runtime team and will post updates there.

@CoryKoehler
Copy link

CoryKoehler commented Mar 25, 2022

@SteveSandersonMS thank you so much. I have been trying to keep track of all the related issues across repositories that seem to be related to this. That is helpful to start getting an idea of where you all are at.

Would it be helpful or noise for me to put my above comment into that issue?

@TanayParikh
Copy link
Contributor

I'm going to close this out in favor of #42055.

@TanayParikh TanayParikh closed this as not planned Won't fix, can't repro, duplicate, stale Jun 6, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jul 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components bug This issue describes a behavior which is not expected - a bug. feature-blazor-wasm This issue is related to and / or impacts Blazor WebAssembly
Projects
None yet
Development

No branches or pull requests

7 participants