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

Proposed by Ian Booth on 2013-10-30
Status: Merged
Approved by: Ian Booth on 2013-10-31
Approved revision: 228
Merged at revision: 228
Proposed branch: lp:~wallyworld/gwacl/fix-request-eof-2
Merge into: lp:gwacl
Diff against target: 61 lines (+15/-8)
3 files modified
retry_policy.go (+0/-8)
storage_base.go (+11/-0)
x509session.go (+4/-0)
To merge this branch: bzr merge lp:~wallyworld/gwacl/fix-request-eof-2
Reviewer Review Type Date Requested Status
Ian Booth Approve on 2013-10-31
Review via email: mp+193346@code.launchpad.net

Commit message

The first fix for the request eof issue worked by setting
Close=true on the http request. This seemed to be not always
work so a different approach is used (same as for goose).
Set DisableKeepAlives=true on the http transport.

Description of the change

Fix request eof #2

The first fix for the request eof issue worked by setting
Close=true on the http request. This seemed to be not always
work so a different approach is used (same as for goose).
Set DisableKeepAlives=true on the http transport.

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

Please take a look.

228. By Ian Booth on 2013-10-30

Ensure all transports have DisableKeepAlives=true

Julian Edwards (julian-edwards) wrote :

This is to much Go-fu for me to really understand what's going on.

Julian Edwards (julian-edwards) wrote :

*too* much, even

Ian Booth (wallyworld) wrote :

Self approving as this is the same solution as used for goose and juju-core.

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-10-17 03:40:36 +0000
3+++ retry_policy.go 2013-10-30 23:15:27 +0000
4@@ -73,10 +73,6 @@
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@@ -107,10 +103,6 @@
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 {
26
27=== modified file 'storage_base.go'
28--- storage_base.go 2013-09-10 01:11:41 +0000
29+++ storage_base.go 2013-10-30 23:15:27 +0000
30@@ -41,6 +41,17 @@
31 "Range",
32 }
33
34+func init() {
35+ // See https://code.google.com/p/go/issues/detail?id=4677
36+ // We need to force the connection to close each time so that we don't
37+ // hit the above Go bug.
38+ roundTripper := http.DefaultClient.Transport
39+ if transport, ok := roundTripper.(*http.Transport); ok {
40+ transport.DisableKeepAlives = true
41+ }
42+ http.DefaultTransport.(*http.Transport).DisableKeepAlives = true
43+}
44+
45 // sign returns the base64-encoded HMAC-SHA256 signature of the given string
46 // using the given base64-encoded key.
47 func sign(accountKey, signable string) (string, error) {
48
49=== modified file 'x509session.go'
50--- x509session.go 2013-08-08 15:11:49 +0000
51+++ x509session.go 2013-10-30 23:15:27 +0000
52@@ -38,6 +38,10 @@
53 TLSClientConfig: &tls.Config{
54 Certificates: certs,
55 },
56+ // See https://code.google.com/p/go/issues/detail?id=4677
57+ // We need to force the connection to close each time so that we don't
58+ // hit the above Go bug.
59+ DisableKeepAlives: true,
60 },
61 }
62

Subscribers

People subscribed via source and target branches

to all changes: