You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was setting the Server.WriteTimeout to 1 second while I set the handler to run for 10 seconds to simulate long running load. Then execute client to access the server.
The client return after 10 seconds. This means even after Server.WriteTimeout is exceeded, the client connection still holds up until handler return the response (though the response would not be retrieved by client, since it is counted as error).
Is this the expected behavior? If so, what is the usage of Server.WriteTimeout actually?
Or perhaps I'm just using it wrong?
Related issues: #24461, #21389 => both of them just discussing about the behavior of ResponseWriter.Write() but not related to overall duration of the request.
Thanks
System details
go version go1.12.4 darwin/amd64
GOARCH="amd64"
GOBIN="/Users/riandyrn/go/bin"
GOCACHE="/Users/riandyrn/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/riandyrn/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.12.4/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.12.4/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
GOROOT/bin/go version: go version go1.12.4 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.12.4
uname -v: Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64
ProductName: Mac OS X
ProductVersion: 10.12.4
BuildVersion: 16E195
lldb --version: lldb-370.0.42
Swift-3.1
The text was updated successfully, but these errors were encountered:
andybons
changed the title
[Server Not Drop Client Connection After Write Timeout]
question: net/http: why does a server not drop client connection after write timeout?
May 14, 2019
For asking questions about learning the language, see one of our forums: https://golang.org/wiki/Questions We only use this issue tracker for tracking bugs. People in the forums can explain what is happening here.
Please answer these questions before submitting your issue. Thanks!
What did you do?
https://play.golang.org/p/HvJuH020rlN
I was setting the
Server.WriteTimeout
to1 second
while I set the handler to run for10 seconds
to simulate long running load. Then execute client to access the server.What did you expect to see?
I was expecting the client would return after
1 second
, because I thoughtServer.WriteTimeout
is used to limit client connection duration, like mentioned in here: https://blog.cloudflare.com/the-complete-guide-to-golang-net-http-timeouts#servertimeouts.What did you see instead?
The client return after
10 seconds
. This means even afterServer.WriteTimeout
is exceeded, the client connection still holds up until handler return the response (though the response would not be retrieved by client, since it is counted as error).Is this the expected behavior? If so, what is the usage of
Server.WriteTimeout
actually?Or perhaps I'm just using it wrong?
Related issues: #24461, #21389 => both of them just discussing about the behavior of
ResponseWriter.Write()
but not related to overall duration of the request.Thanks
System details
The text was updated successfully, but these errors were encountered: