-
Notifications
You must be signed in to change notification settings - Fork 17.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
net/http: http client regression building with js/wasm and running on Chrome: net::ERR_H2_OR_QUIC_REQUIRED
#61889
Comments
net::ERR_H2_OR_QUIC_REQUIRED
net::ERR_H2_OR_QUIC_REQUIRED
net::ERR_H2_OR_QUIC_REQUIRED
CC @neild |
Hi, Running into this issue with go
No issues on go My understanding is that this has something to do with HTTP 1 vs 2. In my case, since I am on local machine, the server runs on Will be nice to see feature detection added as described here?
Thanks. |
Just to clarify, based on that article and my own testing, it's not an issue with HTTP or HTTPS, but more with HTTP 1, regardless of whether SSL/TLS is there or not. |
I reproduced the same error as reported. And, I found that the following merge was the trigger. The following line implements that request body is streamed if the browser supports streaming, regardless fetch() use http/1 or 2. The error
|
I wrote minimum example. https://github.com/haruyama480/go1210-request-streaming-failed |
@jnowls. Correct. Sorry, should have worded it better.
|
Let me summarize this issue. Issue
Cause
How to solveI think there are following solutions.
Yes, I'm not very familiar with the go repository, so could I ask how to fix to Go team or code owner? @johanbrandhorst If there is chance, I would like to contribute to fix it. :) |
CC @hawkinsw. Please feel free to open a CL with a fix, sorry for the inconvenience! |
Thanks for the offer of contributing the fix @haruyama480 :) I don't see any quick and easy way to determine whether or not the browser will complete a HTTP request with H2 or H1 before it happens :(. Just disabling request streaming for HTTP also probably isn't a proper fix since POST requests with HTTPS+H1 (what OP describes) also fail. If we do end up going with implementing it such that clients select whether to use the streaming API, that should probably not be done with a global variable, it will only make things more complicated to deal with, though I'm not sure what the best alternative to give the client the control is. I personally think request streaming should be reverted for now, and revisited at a later point where the streaming API provides proper mechanisms to fallback in case of no support from the server. |
@hhhapz
I completely agree. Also, I agree that adding a global variable isn't good. But, I'm wondering if Falling back will be a good idea. Chaining fetch promise properly would be a general solution. But I'm not sure the nice way to handle req.Body and ReadableStream twice for H2 and H1. That may be complicated. I think It would be enough to focus only on the opt-out flag and decide how to implement it in this issue. |
Any particular reason to make this opt-out instead of opt-in? In the long term lots of users who will be unaware of this will be confused why their code isn't working (or worse, will be unaware it doesn't work in certain contexts). Making it opt-in sounds like the better solution since there is no automatic fallback for this feature at the moment, whereas the regular API is going to work without concern in all contexts. Ultimately, while this is a nice feature, it's not a showbreaker (it just came out this release so very few people are using it, and it's mainly a performance boost ). Until a proper and robust solution is found, where multiple requests don't need to be done, and the developer never needs to care about whether request streaming is happening or not, this feature probably shouldn't be used. |
I agree that it should either be turned off entirely or opt-in, so that it always works as expected by default. The change that introduced this was https://go-review.googlesource.com/c/go/+/458395, so the first step would be to revert this (so that it's working in tip) and then consider reintroducing it with an opt-in. |
@johanbrandhorst , any idea which version of Go the fix will be released in? Thanks. |
At the earliest I expect this to be available in 1.22 unfortunately. It's not severe enough to be included in a patch release (I don't think, at least). It will also depend on when someone can help contribute the fixes outlined. |
@johanbrandhorst , so the revert and the opt-in will need to go in together? Any chance of doing the revert as a patch and the opti-in later? |
Really disappointed if this is the case :/. I have a core interactive application that uses WASM. A revert being included in a patch release should be reconsidered, as this completely breaks the usability of POST requests in Chrome over HTTP, especially since there is no workaround for this fix at all (apart from "just use HTTP/2") I am not familiar with the specific process of how changes are determined to be included within patches vs minor releases, but until this is fixed I am unable to upgrade my application or use any 1.21 features that I would like (including many other improvements to WASM). |
depend on finding a good fallback. If there is a good fallback mechanism, opt-out would be ideally better than opt-in because Chrome user take good performance without configuration. Otherwise opt-in would be better. However, I suspect opt-in mechanism is to be deleted when we find the mechanism later, so I don't feel need to implement opt-in for now.
I agree that. I think it should be released as a patch version up because the latest minor version(means max(1.21.*)) should work by the default, as @hhhapz pointed. |
I see nobody disagree about revert, and submitted CL of revert! |
Change https://go.dev/cl/522955 mentions this issue: |
If I understand correctly, https://go.dev/cl/458395 which added support for streaming HTTP request bodies in wasm bulids, results requests failing when:
Also, it sounds like there is no workaround: Requests always fail when the above conditions are met. Is that all correct? If so, I agree that we should roll this change back. We should also backport the rollback to the next 1.21 minor release, as this is both a significant regression (you can't send requests at all under these circumstances) and there is no workaround. |
Thanks for chiming in Neil, I'm pleased to hear that this will be considered for the next minor release. Given that @haruyama480 has submitted a CL to remove this from tip, what is the process for backporting the fix to the release branch? Is it automated or will it need someone to cherry pick the revert to the release branch? Do we need a backport issue? |
@gopherbot please backport to 1.21. This is a regression with no workaround. |
Backport issue(s) opened: #62328 (for 1.21). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
Process is documented here: https://go.dev/wiki/MinorReleases. In short, the release manager will approve (or reject) the backport issue. If/when approved, I'll make a cherry-pick CL for the backport, and the release manager will merge it into the 1.21 release branch. |
Thank you all for the great conversation around this issue. I am sorry for a number of things:
I thought lots about this problem over the weekend and I think that I might have a way to allow the user to opt-in: Some applications (like one that I am writing) explicitly call http2.ConfigureTransports after having created an In those cases, we could use a type assertion in the runtime to check whether the round tripper's transport is the H2 variety. Obviously, if the user has taken these actions to seek out H2, then we would reasonably assume that they would be okay if it failed in the scenario where a connection to the server could not be completed over that protocol. What do people think about this as a possibility for doing opt in? |
I don't think adding explicit type assertions into the code is the way to go. The problem with that is that it becomes impossible for users to wrap the transport transparently. I'd sooner see we allow the user to be more explicit about opting in. We already have a pattern for configuring the HTTP request via headers (See https://go.googlesource.com/go/+/refs/heads/master/src/net/http/roundtrip_js.go#26 and friends). We could probably just add another header that would opt into the behavior? |
That is perfectly okay with me! I was just excited that I found a technical way to do what we wanted! |
Change https://go.dev/cl/513458 mentions this issue: |
Change https://go.dev/cl/524855 mentions this issue: |
…ent in wasm" CL 458395 added support for streaming POST content in Wasm. Unfortunately, this breaks requests to servers that only support HTTP/1.1. Revert the change until a suitable fallback or opt-in strategy can be decided. For #61889. Fixes #62328. Change-Id: If53a77e1890132063b39abde867d34515d4ac2af Reviewed-on: https://go-review.googlesource.com/c/go/+/522955 Run-TryBot: Johan Brandhorst-Satzkorn <[email protected]> Reviewed-by: Damien Neil <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Bryan Mills <[email protected]> Reviewed-by: Johan Brandhorst-Satzkorn <[email protected]> Reviewed-on: https://go-review.googlesource.com/c/go/+/524855 Run-TryBot: Dmitri Shuralyov <[email protected]> Commit-Queue: Dmitri Shuralyov <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
NOTE: I only get these errors in Chromium based browsers, not in Firefox.
I have this following function:
compiled with:
GOOS=js GOARCH=wasm go test -c -o test.wasm -run TestPersist
I ran this with the default
wasm_exec.html
thats provided in$GOROOT/misc/wasm
with just addingtest.v
toargv:
.This works with go1.20, but not with go1.21.
Reproducible example available at https://github.com/jnowls/wasm-http-chrome - just run ./run.sh
What did you expect to see?
The browser successfully complete the request (as seen in Firefox and older versions of chrome)
What did you see instead?
Firefox go1.21 and go1.20:


Chrome go1.21 and go1.20:


The text was updated successfully, but these errors were encountered: