Details
-
Bug
-
Resolution: Won't Fix
-
Critical
-
None
-
master
-
Untriaged
-
Unknown
Description
When Sync Gateway is deployed in an Azure environment, view queries made through go-couchbase are periodically hanging/timing out. The Azure VM idle timeout appears to be killing connections that do not have a keep-alive configured.
go-couchbase supports enabling TCP keep-alive for memcached communication, but doesn't enable keep-alive for HTTP requests. Specifically, the HTTP Transport used by go-couchbase's default HTTPClient doesn't enable keep-alive in the DialContext:
https://github.com/couchbase/go-couchbase/blob/master/pools.go#L29
It would be preferable for go-couchbase to initialize HTTPTransport using the golang DefaultTransport, before customizing properties like MaxIdleConnsFromHost. This will pick up the DefaultTransport's settings for keep-alive, among others:
https://golang.org/pkg/net/http/#RoundTripper
Support has sanity tested this change in an Azure environment that reproduced the issue, and it was proven to avoid the keep-alive issues.