net/http: concurrent HTTP2 client requests to a single nginx server returns GOAWAY NO_ERROR after a while #18112
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
What version of Go are you using (
go version
)?go version go1.7.3 linux/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
Have multiple goroutines accessing single nginx server over HTTP2.
Default nginx installation will serve up to 1999 streams (1000 requests) over single HTTP2 TCP connection before returning GOAWAY and closing the connection. It is controlled by
http2_max_requests
directive. If multiple goroutines are making requests when server issues GOAWAY, reconnect is handled ungracefully and some goroutines receive error instead of requested content. If http client is used by single goroutine synchronously such errors never occur.Example code:
https://play.golang.org/p/mPaBxuuRmm
Please note that this code will not work inside playground because of network access restrictions. It will work if executed locally. Example contains publicly accessible server that is operated by me. The error can be reproduced by connecting to nginx.com CDN as well (URL is commented out in the example) however it has much higher
http2_max_requests
configured and one have to wait much longer for the error to occur (~15k connections last time I tired).What did you expect to see?
Application looping forever without errors (except network connectivity issues or server side errors).
What did you see instead?
After ~1000 requests server tries to close TCP connection with GOAWAY, some requests are terminated with an error:
http2: server sent GOAWAY and closed the connection; LastStreamID=1999, ErrCode=NO_ERROR, debug=""
If only one goroutine is making requests this error never occurs.
The text was updated successfully, but these errors were encountered: