Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
net/http: GOAWAY reported as http.http2GoAwayError instead of http2.GoAwayError #28930
What version of Go are you using (
@agnivade Not sure exactly what should be the solution, but there should be a way to "catch" this error.
Btw, the posiibility to return package-specific error to other packages seems somewhat wrong.
This is an unfortunate side effect of how we bundle http2 into net/http. There really are two distinct types, copies of each other: http.GoAwayError and net/http.http2GoAwayError. We're not going to export the latter.
But this isn't even an error that's meant to be acted on: the server sends those during graceful shutdown but shouldn't be interrupting existing requests in flight. If the GOAWAY last_stream_id is less than the one we just sent, the Transport will already reschedule it onto a different/new connection. The only time you should be seeing this if the response body was already partially sent/consumed and the server just closed the connection un-gracefully.
But that's no more interesting than a server that just had its http server crash or otherwise closed its TCP connections ungracefully. If it's important to you, retry. Why is this specific error interesting? If it is, we could add an
Could you explain more about why you care about this error in particular?
That's probably my case. I send multiple requests to low performance server at one time (scrapper). It seems that when nginx feels overloaded it just sends goaway in the middle of response - which effectively means that I get no useful response.
But this is really not important - tha case is that sometimes TCP connection returns error instead of useful response - developer should have opportunity to handle it I suppose.
I should retry you say, and it is precisely what I do. But when should I retry?
I react to
So in effect, I can react to this specific error either via
In conclusion - I do not want to react precisely to