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: Transport.CancelRequest doesn't work on connections blocked in dial #6951

Closed
gopherbot opened this issue Dec 14, 2013 · 6 comments
Closed
Milestone

Comments

@gopherbot
Copy link

by isaac.dawson:

Before filing a bug, please check whether it has been fixed since the
latest release. Search the issue tracker and check that you're running the
latest version of Go:

Run "go version" and compare against
http://golang.org/doc/devel/release.html  If a newer version of Go exists,
install it and retry what you did to reproduce the problem.

Thanks.

What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.
1. Set timeouts for connect/read for http.Client's transport
2. Make request to stupid HTTPS website which doesn't properly handshake
3. Watch as it never kills the connection
4. Ref: http://play.golang.org/p/gyI1e5UoPq

What is the expected output?
Timeouts should be in effect and kill the connection.

What do you see instead?
Absolutely nothing happen.

Which compiler are you using (5g, 6g, 8g, gccgo)?
The binaries from 

Which operating system are you using?
Windows 8.1

Which version are you using?  (run 'go version')
go version go1.2 windows/amd64
https://code.google.com/p/go/downloads/detail?name=go1.2.windows-amd64.zip&;can=2&q=OpSys-Windows+Type%3DArchive

Please provide any additional information below.
This may or may not be related to https://golang.org/issue/3362. I
definitely noticed a higher chance of HTTPS sites refusing to 'let go' of their
connections. When trying to crawl lots of sites, it becomes impossible because workers
become blocked and I can't seem to kill the connection.

This actually happens a lot when attempting to crawl the Alexa Top 1 million sites, lots
of sites appear to accept the connection but just hold on to them indefinitely.
@gopherbot
Copy link
Author

Comment 1 by isaac.dawson:

I miss pasted, the binaries from should be link found in the which version of go you are
using.

@garyburd
Copy link
Contributor

Comment 2:

I saw this problem on Linux.  A stack dump is available at
golang/gddo#139.
Transport.getConn starts a goroutine to dial a connection and waits for the goroutine to
complete or for a connection to be returned to the pool.
Transport.dialConn blocks on the TLS handshake.
Transport.CancelRequest does not work because the connection has not been added to
Transport.reqConn.

@gopherbot
Copy link
Author

Comment 3 by isaac.dawson:

awesome, thanks for the work around, works like a charm!

@bradfitz
Copy link
Contributor

Comment 4:

Labels changed: added release-go1.3, repo-main.

Owner changed to @bradfitz.

Status changed to Started.

@bradfitz
Copy link
Contributor

Comment 5:

Sent https://golang.org/cl/69280043 Anybody want to review? Gary?

@bradfitz
Copy link
Contributor

Comment 6:

This issue was closed by revision dc6bf29.

Status changed to Fixed.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants