{"action":"opened","issue":{"url":"https://api.github.com/repos/tianon/rawdns/issues/8","labels_url":"https://api.github.com/repos/tianon/rawdns/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/tianon/rawdns/issues/8/comments","events_url":"https://api.github.com/repos/tianon/rawdns/issues/8/events","html_url":"https://github.com/tianon/rawdns/issues/8","id":107534751,"number":8,"title":"fd leak while connecting to docker on pf_local socket","user":{"login":"sbodomerle","id":2766702,"avatar_url":"https://avatars.githubusercontent.com/u/2766702?v=3","gravatar_id":"","url":"https://api.github.com/users/sbodomerle","html_url":"https://github.com/sbodomerle","followers_url":"https://api.github.com/users/sbodomerle/followers","following_url":"https://api.github.com/users/sbodomerle/following{/other_user}","gists_url":"https://api.github.com/users/sbodomerle/gists{/gist_id}","starred_url":"https://api.github.com/users/sbodomerle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sbodomerle/subscriptions","organizations_url":"https://api.github.com/users/sbodomerle/orgs","repos_url":"https://api.github.com/users/sbodomerle/repos","events_url":"https://api.github.com/users/sbodomerle/events{/privacy}","received_events_url":"https://api.github.com/users/sbodomerle/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-21T15:15:10Z","updated_at":"2015-09-21T15:15:10Z","closed_at":null,"body":"After deploying rawdns (version 1.2~ds1-1 from debian) in a small sized docker environment - i got the following errors, just a fetr a few minutes of operation:\r\n\r\nrawdns[34447]: 2015/09/18 13:03:08 error: failed to lookup container \"test\": failed HTTP request: Get http://unix-socket/v1.14/containers/rabbitmq/json: dial unix /var/run/docker.sock: too many open files\r\n\r\nlsof shows that rawdns has consumed all the 1021 fd's.\r\nThe following small patch fixes the issue for me:\r\n\r\ndiff --git a/src/cmd/rawdns/docker.go b/src/cmd/rawdns/docker.go\r\nindex 94c3140..7d763a5 100644\r\n--- a/src/cmd/rawdns/docker.go\r\n+++ b/src/cmd/rawdns/docker.go\r\n@@ -58,6 +58,7 @@ func httpClient(u *url.URL) *http.Client {\r\n                transport.Dial = func(proto, addr string) (net.Conn, error) {\r\n                        return net.Dial(\"unix\", path)\r\n                }\r\n+               transport.DisableKeepAlives = true\r\n                u.Scheme = \"http\"\r\n                u.Host = \"unix-socket\"\r\n                u.Path = \"\"\r\n"}}