Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: Request.Context() canceled on Server.ReadTimeout #18447

Closed
artyom opened this issue Dec 28, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@artyom
Copy link
Contributor

commented Dec 28, 2016

Please answer these questions before submitting your issue. Thanks!

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

Currently documentation for Request.Context() states:

For incoming server requests, the context is canceled when the client's connection closes, the request is canceled (with HTTP/2), or when the ServeHTTP method returns.

This does not include context cancelation by Server.ReadTimeout. Please see this example: https://play.golang.org/p/lY9cGHG-pK

What did you expect to see?

~ ¶ curl -D- http://localhost:8080
HTTP/1.1 200 OK
Date: Wed, 28 Dec 2016 18:59:30 GMT
Content-Length: 5
Content-Type: text/plain; charset=utf-8

done

What did you see instead?

~ ¶ curl -D- http://localhost:8080
HTTP/1.1 200 OK
Date: Wed, 28 Dec 2016 18:59:45 GMT
Content-Length: 17
Content-Type: text/plain; charset=utf-8

context canceled

Does this issue reproduce with the latest release (go1.7.4)?

No

System details

go version go1.8beta2 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/tmp/go:/Users/artyom/go"
GORACE=""
GOROOT="/Users/artyom/Library/go"
GOTOOLDIR="/Users/artyom/Library/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/lb/3rk8rqs53czgb4v35w_342xc0000gn/T/go-build310476467=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
GOROOT/bin/go version: go version go1.8beta2 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.8beta2 X:framepointer
uname -v: Darwin Kernel Version 16.3.0: Thu Nov 17 20:23:58 PST 2016; root:xnu-3789.31.2~1/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.12.2
BuildVersion:	16C67
lldb --version: lldb-360.1.70
@bradfitz

This comment has been minimized.

Copy link
Member

commented Jan 3, 2017

Thanks for the report.

@gopherbot

This comment has been minimized.

Copy link

commented Jan 4, 2017

CL https://golang.org/cl/34813 mentions this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.