Sorry. I misrepresented the problem. The issue was that the example should 
print "wrote 4096, err http2: stream closed" after a second, having filled 
the buffer with 64 64KiB writes first. Even with go1.17.6, it doesn't do 
that. The 65th write is not timing out.

But it does work if I use the recent golang.org/x/net.

I see the http2 code is in h2_bundle.go and the cherry picked changes are 
in fact there, in the go1.17.6 tagged checkout. So the cherry-pick 
operation was done correctly. Maybe that cherry-pick was necessary but it 
appears it isn't sufficient.

To get the intended behavior, the timeout after a second of being hung, I 
still have to require the golang.org/x/net from 20220127 and configure the 
server with it

    func main() {
        sv := httptest.NewUnstartedServer(http.HandlerFunc(handler))
        err := http2.ConfigureServer(sv.Config, &http2.Server{})
        if err != nil {
            log.Fatal(err)
        }
        // defer sv.Close()
        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
    }

My go.mod:

    module main

    go 1.17

    require golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd

    require golang.org/x/text v0.3.7 // indirect
On Friday, January 28, 2022 at 4:29:07 PM UTC-5 Ian Lance Taylor wrote:

> On Fri, Jan 28, 2022 at 6:44 AM frankre...@gmail.com
> <frankre...@gmail.com> wrote:
> >
> > https://github.com/golang/go/issues/49741
> >
> > 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.
>
> The x/net/http2 sources are bundled into the generated file
> net/http/h2_bundle.go.
>
>
> > Here's the example @davecheney provided:
>
> That program is always going to hang, because the main function never
> returns. I'm not sure what the buggy behavior is here.
>
> Ian
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/eba2dce6-97ea-483b-968c-6d415c801eb2n%40googlegroups.com.

Reply via email to