net/http: server does not send response on timeout #47229
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?go1.16.4 linux/amd64
Does this issue reproduce with the latest release?
I think so.
What operating system and processor architecture are you using (
go env
)?go env
OutputBackground
The attached code shows an example of setting up an http server with a
WriteTimeout
which is smaller than the processing time of the requests. This is a minimal repro of an issue we've encountered in go-etherem: ethereum/go-ethereum#21430The used timeout is
1s
, and any request containing the wordsleep
will take2s
to complete.Expected behaviour
I expect the following things to happen:
http.ResponseWriter
, theWrite
method should should return an error.1s
, receive a HTTP error response, such as500 Internal Server Error
or504 Gateway Timeout
.Actual behaviour
Write
method does not return an error.2s
, the server shuts down the connection without sending a reply.1
second, when the timeout hits, but when the response internally is actually finished and ready to be delivered.Example run:
An example run where I make two requests, one which times out and one which does not.
Server side:
Client side:
The text was updated successfully, but these errors were encountered: