-
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
x/tools/godoc/proxy: proxying to playground sometimes hangs perpetually #28134
Comments
My guess is the http.Transport's persistent connections die over time (credentials timeout in socket gateway?) and because there are no heartbeats or anything, it just blocks forever. I'd start by disabling the Transport's KeepAlives and see if that fixes it. If so, we can escalate the bug to the Flex team. |
That doesn't actual tell me much. |
Hm, OK. Will add some more logging on both ends.
Definitely not this -- socket gateway is not used anymore. |
Actually what would help the most is a goroutine dump (of all goroutines) if the proxy is taking longer than N seconds. (start a timer.AfterFunc, cancel it on successful proxy, then have the AfterFunc func log all goroutine stacks) That'd show me where the Transport code is stuck.
I think it probably still exists a few layers down in some form, even if the API is now just "use Linux system calls". Or other theory: the Flex tasks for play.golang.org are changing in count or starting/stopping or somehow rescheduling and the "TCP" connections from the proxy are just getting stuck without ever seeing a RST. (I still mean to do #25883 for Go 1.12, which would fix this if it were the problem.) |
Yes, I have been seeing this too. A short reproducer using
|
Unrelated, but it seems /share proxying is even more broken. I'll look at that next. I've deployed a version with some extra logging, but can't reproduce the hang on that new version. Very odd. I'm going to redirect production traffic over to that momentarily to see if there's some other interaction going on.
Flex runs on a GCE VM, so there's no gVisor happening here. |
Goroutine dump: It's odd there are so many goroutines for the /share endpoint - it looks like there isn't even any incoming requests for share (or they just never complete). So, this probably actually is related to /share being broken? Is the share proxy exhausting all of the connections available? Note that they're both hitting the same host (play.golang.org). Oddness about the httputil reverse proxy:
Maybe there's some Flex header that needs to be filtered out? (Still doesn't explain the 404 running locally) Replacing the reverse proxy with a simplified proxy seems to alleviate the issue. I'm out of time to investigate today, but I'll send a CL with a workaround -- a simplified proxy for /share. |
Change https://golang.org/cl/141718 mentions this issue: |
Change https://golang.org/cl/153858 mentions this issue: |
…oxy for /share ReverseProxy doesn't re-set the Request's Host field, only Request.URL.Host. The HTTP/2 client prefers Request.Host over Request.URL.Host, so this results in the request being sent back to the host that originally accepted the request. This results in an infinite redirect (and consumption of many connections to itself). See Issue golang/go#28168 for details. Replace it with a simple proxy that drops all the headers (except Content-Type). I tried setting the proxy.Director, but it still didn't work. Could do with some more investigation. Fixes golang/go#28134. Change-Id: I5051ce72a379dcacfbe8484f58f8cf7d9385024d Reviewed-on: https://go-review.googlesource.com/c/141718 Run-TryBot: Chris Broadfoot <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> (cherry picked from commit 837e805) Reviewed-on: https://go-review.googlesource.com/c/153858 Run-TryBot: Andrew Bonventre <[email protected]>
This is live on golang.org. Thanks, @broady! |
ReverseProxy doesn't re-set the Request's Host field, only Request.URL.Host. The HTTP/2 client prefers Request.Host over Request.URL.Host, so this results in the request being sent back to the host that originally accepted the request. This results in an infinite redirect (and consumption of many connections to itself). See Issue golang/go#28168 for details. Replace it with a simple proxy that drops all the headers (except Content-Type). I tried setting the proxy.Director, but it still didn't work. Could do with some more investigation. Fixes golang/go#28134. Change-Id: I5051ce72a379dcacfbe8484f58f8cf7d9385024d Reviewed-on: https://go-review.googlesource.com/c/141718 Run-TryBot: Chris Broadfoot <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
Running the program below gives very different results. Sometimes hanging for three minutes until finally giving up, or going through without issue. This only tests the /compile endpoint. It's uncertain whether this affects the /share endpoint as well.
Worth flagging since we just switched over to flex on golang.org.
/cc @broady @dmitshur @bradfitz
The text was updated successfully, but these errors were encountered: