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: context isn't canceled on client disconnection #20668

Closed
utrack opened this issue Jun 14, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@utrack
Copy link

commented Jun 14, 2017

What version of Go are you using (go version)?

go version go1.7.4 linux/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/u/go"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build348831087=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

Arch Linux

What did you do?

Stumbled upon it on failing tests. Here's a snippet:
https://play.golang.org/p/v4ij4Elrqa

What did you expect to see?

Get http://127.0.0.1:2/: context deadline exceeded
true

Works like this on latest (go 1.8.*)

What did you see instead?

Get http://127.0.0.1:44773/: net/http: request canceled
false

This test is kinda hacky b/c .Shutdown() and .Close() aren't there on Go 1.7.
The point is: r.Context() is never canceled on server's side once client disconnects.

@bradfitz

This comment has been minimized.

Copy link
Member

commented Jun 14, 2017

Correct. This was implemented in Go 1.8.

@bradfitz bradfitz closed this Jun 14, 2017

@golang golang locked and limited conversation to collaborators Jun 14, 2018

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.