[ARVADOS] created: 1.2.0-364-g2ea20b224

Git user git at public.curoverse.com
Wed Nov 14 13:49:52 EST 2018


        at  2ea20b22448fc61a88e73ab3f26daaea9a866ce4 (commit)


commit 2ea20b22448fc61a88e73ab3f26daaea9a866ce4
Author: Tom Clegg <tclegg at veritasgenetics.com>
Date:   Wed Nov 14 13:49:39 2018 -0500

    14419: Fix concurrent map write.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tclegg at veritasgenetics.com>

diff --git a/sdk/go/keepclient/keepclient.go b/sdk/go/keepclient/keepclient.go
index 6a3e83796..ab610d65e 100644
--- a/sdk/go/keepclient/keepclient.go
+++ b/sdk/go/keepclient/keepclient.go
@@ -546,31 +546,26 @@ func (kc *KeepClient) httpClient() HTTPClient {
 		keepAlive = DefaultKeepAlive
 	}
 
-	transport, ok := http.DefaultTransport.(*http.Transport)
-	if ok {
-		copy := *transport
-		transport = &copy
-	} else {
-		// Evidently the application has replaced
-		// http.DefaultTransport with a different type, so we
-		// need to build our own from scratch using the Go 1.8
-		// defaults.
-		transport = &http.Transport{
+	c := &http.Client{
+		Timeout: requestTimeout,
+		// It's not safe to copy *http.DefaultTransport
+		// because it has a mutex (which might be locked)
+		// protecting a private map (which might not be nil).
+		// So we build our own, using the Go 1.10 default
+		// values, ignoring any changes the application has
+		// made to http.DefaultTransport.
+		Transport: &http.Transport{
+			DialContext: (&net.Dialer{
+				Timeout:   connectTimeout,
+				KeepAlive: keepAlive,
+				DualStack: true,
+			}).DialContext,
 			MaxIdleConns:          100,
 			IdleConnTimeout:       90 * time.Second,
+			TLSHandshakeTimeout:   tlsTimeout,
 			ExpectContinueTimeout: time.Second,
-		}
-	}
-	transport.DialContext = (&net.Dialer{
-		Timeout:   connectTimeout,
-		KeepAlive: keepAlive,
-		DualStack: true,
-	}).DialContext
-	transport.TLSHandshakeTimeout = tlsTimeout
-	transport.TLSClientConfig = arvadosclient.MakeTLSConfig(kc.Arvados.ApiInsecure)
-	c := &http.Client{
-		Timeout:   requestTimeout,
-		Transport: transport,
+			TLSClientConfig:       arvadosclient.MakeTLSConfig(kc.Arvados.ApiInsecure),
+		},
 	}
 	defaultClient[kc.Arvados.ApiInsecure][kc.foundNonDiskSvc] = c
 	return c

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list