Merge lp:~wallyworld/gwacl/fix-request-eof into lp:gwacl

Proposed by Ian Booth on 2013-10-17
Status: Merged
Approved by: Ian Booth on 2013-10-17
Approved revision: 226
Merged at revision: 226
Proposed branch: lp:~wallyworld/gwacl/fix-request-eof
Merge into: lp:gwacl
Diff against target: 25 lines (+8/-0)
1 file modified
retry_policy.go (+8/-0)
To merge this branch: bzr merge lp:~wallyworld/gwacl/fix-request-eof
Reviewer Review Type Date Requested Status
Julian Edwards (community) 2013-10-17 Approve on 2013-10-17
Review via email: mp+191545@code.launchpad.net

Commit message

Ensure Close = true when sending http requests.

This is needed to avoid this bug in Go's http lib:
https://code.google.com/p/go/issues/detail?id=4677

Description of the change

Ensure Close = true when sending http requests.

This is needed to avoid this bug in Go's http lib:
https://code.google.com/p/go/issues/detail?id=4677

To post a comment you must log in.
Ian Booth (wallyworld) wrote :

Please take a look.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'retry_policy.go'
2--- retry_policy.go 2013-08-09 14:59:50 +0000
3+++ retry_policy.go 2013-10-17 01:28:01 +0000
4@@ -73,6 +73,10 @@
5 }
6
7 func (ret *retrier) RetryRequest(request *http.Request) (*http.Response, error) {
8+ // See https://code.google.com/p/go/issues/detail?id=4677
9+ // We need to force the connection to close each time so that we don't
10+ // hit the above Go bug.
11+ request.Close = true
12 for {
13 response, err := ret.client.Do(request)
14 if err != nil {
15@@ -103,6 +107,10 @@
16 }
17
18 func (ret *forkedHttpRetrier) RetryRequest(request *forkedHttp.Request) (*forkedHttp.Response, error) {
19+ // See https://code.google.com/p/go/issues/detail?id=4677
20+ // We need to force the connection to close each time so that we don't
21+ // hit the above Go bug.
22+ request.Close = true
23 for {
24 response, err := ret.client.Do(request)
25 if err != nil {

Subscribers

People subscribed via source and target branches

to all changes: