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.
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)