x/net/http2: http.Server.WriteTimeout does not fire if the http2 stream's window is out of space. #49741
The 1.17 back port issue:
x/net/http2: http.Server.WriteTimeout does not fire if the http2 stream's window is out of space. [1.17 backport] #49921
Loaded go1.17.6 on Mac and Linux machines. Saw the release notes say issue #49741 is cherry-picked as #49921. Looked at the issue and found a very concise hanging example and expected the example would no longer hang. But it hangs on both Mac and Linux.
I admit to being confused by how the x/net/http2 source is being vendored. I did not find the source files in the go1.17.6 source tree created from the go1.17.6.tar.gz download.
Here's the example @davecheney provided:
```go
package main
import (
"io"
"log"
"net/http"
"net/http/httptest"
"strings"
"time"
)
func handler(w http.ResponseWriter, r *http.Request) {
data := strings.Repeat("x", 1<<16)
tick := time.NewTicker(1 * time.Millisecond)
defer tick.Stop()
for {
select {
case <-tick.C:
n, err := io.WriteString(w, data)
log.Printf("wrote %d, err %v", n, err)
if err != nil {
return
}
case <-r.Context().Done():
log.Printf("context cancelled")
return
}
}
}
func main() {
sv := httptest.NewUnstartedServer(http.HandlerFunc(handler))
sv.EnableHTTP2 = true
sv.Config.WriteTimeout = 1 * time.Second
sv.StartTLS()
resp, err := sv.Client().Get(sv.URL + "/")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
select {} // block forever
}
```