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

Proposed by Ian Booth
Status: Merged
Approved by: Ian Booth
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
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.
Revision history for this message
Ian Booth (wallyworld) wrote :

Please take a look.

228. By Ian Booth

Ensure all transports have DisableKeepAlives=true

Revision history for this message
Julian Edwards (julian-edwards) wrote :

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

Revision history for this message
Julian Edwards (julian-edwards) wrote :

*too* much, even

Revision history for this message
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
=== modified file 'retry_policy.go'
--- retry_policy.go 2013-10-17 03:40:36 +0000
+++ retry_policy.go 2013-10-30 23:15:27 +0000
@@ -73,10 +73,6 @@
73}73}
7474
75func (ret *retrier) RetryRequest(request *http.Request) (*http.Response, error) {75func (ret *retrier) RetryRequest(request *http.Request) (*http.Response, error) {
76 // See https://code.google.com/p/go/issues/detail?id=4677
77 // We need to force the connection to close each time so that we don't
78 // hit the above Go bug.
79 request.Close = true
80 for {76 for {
81 response, err := ret.client.Do(request)77 response, err := ret.client.Do(request)
82 if err != nil {78 if err != nil {
@@ -107,10 +103,6 @@
107}103}
108104
109func (ret *forkedHttpRetrier) RetryRequest(request *forkedHttp.Request) (*forkedHttp.Response, error) {105func (ret *forkedHttpRetrier) RetryRequest(request *forkedHttp.Request) (*forkedHttp.Response, error) {
110 // See https://code.google.com/p/go/issues/detail?id=4677
111 // We need to force the connection to close each time so that we don't
112 // hit the above Go bug.
113 request.Close = true
114 for {106 for {
115 response, err := ret.client.Do(request)107 response, err := ret.client.Do(request)
116 if err != nil {108 if err != nil {
117109
=== modified file 'storage_base.go'
--- storage_base.go 2013-09-10 01:11:41 +0000
+++ storage_base.go 2013-10-30 23:15:27 +0000
@@ -41,6 +41,17 @@
41 "Range",41 "Range",
42}42}
4343
44func init() {
45 // See https://code.google.com/p/go/issues/detail?id=4677
46 // We need to force the connection to close each time so that we don't
47 // hit the above Go bug.
48 roundTripper := http.DefaultClient.Transport
49 if transport, ok := roundTripper.(*http.Transport); ok {
50 transport.DisableKeepAlives = true
51 }
52 http.DefaultTransport.(*http.Transport).DisableKeepAlives = true
53}
54
44// sign returns the base64-encoded HMAC-SHA256 signature of the given string55// sign returns the base64-encoded HMAC-SHA256 signature of the given string
45// using the given base64-encoded key.56// using the given base64-encoded key.
46func sign(accountKey, signable string) (string, error) {57func sign(accountKey, signable string) (string, error) {
4758
=== modified file 'x509session.go'
--- x509session.go 2013-08-08 15:11:49 +0000
+++ x509session.go 2013-10-30 23:15:27 +0000
@@ -38,6 +38,10 @@
38 TLSClientConfig: &tls.Config{38 TLSClientConfig: &tls.Config{
39 Certificates: certs,39 Certificates: certs,
40 },40 },
41 // See https://code.google.com/p/go/issues/detail?id=4677
42 // We need to force the connection to close each time so that we don't
43 // hit the above Go bug.
44 DisableKeepAlives: true,
41 },45 },
42 }46 }
4347

Subscribers

People subscribed via source and target branches

to all changes: