9005: 11726: 11729: Disable http keepalive.
authorTom Clegg <tom@curoverse.com>
Fri, 19 May 2017 23:11:05 +0000 (19:11 -0400)
committerTom Clegg <tom@curoverse.com>
Fri, 19 May 2017 23:16:27 +0000 (19:16 -0400)
The previous workaround for #9005 did not account for the prefetch
feature: if a goroutine is using the HTTP client to prefetch data at
the moment the handler exits, CloseIdleConnections() does not close
that connection, so it stays open indefinitely.

services/keep-web/handler.go

index 5e3e4afdb41f7a703b9bc1f978d203642d1aaea3..008876488b97aa675e30541754ec4e8c814ffe8f 100644 (file)
@@ -338,7 +338,7 @@ func (h *handler) ServeHTTP(wOrig http.ResponseWriter, r *http.Request) {
        if client, ok := kc.Client.(*http.Client); ok && client.Transport != nil {
                // Workaround for https://dev.arvados.org/issues/9005
                if t, ok := client.Transport.(*http.Transport); ok {
-                       defer t.CloseIdleConnections()
+                       t.DisableKeepAlives = true
                }
        }
        rdr, err := kc.CollectionFileReader(collection, filename)