From e606e74feda6c88e147c302d1cf734f24737a048 Mon Sep 17 00:00:00 2001 From: Chris Goller Date: Tue, 28 Feb 2017 15:17:36 -0600 Subject: [PATCH 1/2] Fix influx querying to prevent leaking sockets --- influx/influx.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/influx/influx.go b/influx/influx.go index 60ef9f786e..02d8eebf1a 100644 --- a/influx/influx.go +++ b/influx/influx.go @@ -13,6 +13,14 @@ import ( var _ chronograf.TimeSeries = &Client{} +// Shared transports for all clients to prevent leaking connections +var ( + skipVerifyTransport = &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + } + defaultTransport = &http.Transport{} +) + // Client is a device for retrieving time series data from an InfluxDB instance type Client struct { URL *url.URL @@ -74,10 +82,9 @@ func (c *Client) query(u *url.URL, q chronograf.Query) (chronograf.Response, err hc := &http.Client{} if c.InsecureSkipVerify { - tr := &http.Transport{ - TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, - } - hc.Transport = tr + hc.Transport = skipVerifyTransport + } else { + hc.Transport = defaultTransport } resp, err := hc.Do(req) if err != nil { From 7d29bf92a979cb015aecf7b3cff064ea23f49601 Mon Sep 17 00:00:00 2001 From: Chris Goller Date: Tue, 28 Feb 2017 16:08:24 -0600 Subject: [PATCH 2/2] Update CHANGELOG to mention fixing socket leaks --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99cbd06cef..d157bc66b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## v1.2.0 [unreleased] ### Bug Fixes + 1. [#936](https://github.com/influxdata/chronograf/pull/936): Fix leaking sockets for InfluxQL queries ### Features