{"action":"created","issue":{"url":"https://api.github.com/repos/getlantern/lantern/issues/2476","labels_url":"https://api.github.com/repos/getlantern/lantern/issues/2476/labels{/name}","comments_url":"https://api.github.com/repos/getlantern/lantern/issues/2476/comments","events_url":"https://api.github.com/repos/getlantern/lantern/issues/2476/events","html_url":"https://github.com/getlantern/lantern/pull/2476","id":73491495,"number":2476,"title":"add fix for https://github.com/getlantern/lantern/issues/2402","user":{"login":"atavism","id":6346213,"avatar_url":"https://avatars.githubusercontent.com/u/6346213?v=3","gravatar_id":"","url":"https://api.github.com/users/atavism","html_url":"https://github.com/atavism","followers_url":"https://api.github.com/users/atavism/followers","following_url":"https://api.github.com/users/atavism/following{/other_user}","gists_url":"https://api.github.com/users/atavism/gists{/gist_id}","starred_url":"https://api.github.com/users/atavism/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atavism/subscriptions","organizations_url":"https://api.github.com/users/atavism/orgs","repos_url":"https://api.github.com/users/atavism/repos","events_url":"https://api.github.com/users/atavism/events{/privacy}","received_events_url":"https://api.github.com/users/atavism/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-06T02:22:58Z","updated_at":"2015-05-08T04:30:26Z","closed_at":"2015-05-06T03:54:42Z","pull_request":{"url":"https://api.github.com/repos/getlantern/lantern/pulls/2476","html_url":"https://github.com/getlantern/lantern/pull/2476","diff_url":"https://github.com/getlantern/lantern/pull/2476.diff","patch_url":"https://github.com/getlantern/lantern/pull/2476.patch"},"body":"This is related to the error fetching ``cloud.yaml`` we've been seeing for a long time in Loggly. The ``resp.Body.Close() `` is insufficient, and we need to explicitly indicate the request should be closed after we finish reading the response body. More details here: https://stackoverflow.com/questions/17714494/golang-http-request-results-in-eof-errors-when-making-multiple-requests-successi"},"comment":{"url":"https://api.github.com/repos/getlantern/lantern/issues/comments/100098008","html_url":"https://github.com/getlantern/lantern/pull/2476#issuecomment-100098008","issue_url":"https://api.github.com/repos/getlantern/lantern/issues/2476","id":100098008,"user":{"login":"myleshorton","id":1143966,"avatar_url":"https://avatars.githubusercontent.com/u/1143966?v=3","gravatar_id":"","url":"https://api.github.com/users/myleshorton","html_url":"https://github.com/myleshorton","followers_url":"https://api.github.com/users/myleshorton/followers","following_url":"https://api.github.com/users/myleshorton/following{/other_user}","gists_url":"https://api.github.com/users/myleshorton/gists{/gist_id}","starred_url":"https://api.github.com/users/myleshorton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/myleshorton/subscriptions","organizations_url":"https://api.github.com/users/myleshorton/orgs","repos_url":"https://api.github.com/users/myleshorton/repos","events_url":"https://api.github.com/users/myleshorton/events{/privacy}","received_events_url":"https://api.github.com/users/myleshorton/received_events","type":"User","site_admin":false},"created_at":"2015-05-08T04:30:26Z","updated_at":"2015-05-08T04:30:26Z","body":"Interesting @atavism thanks. To me the thinking here seems slightly incorrect though TBH. We create a new util.HTTPClient on each poll, which in turn creates a new transport. While I agree we want to close those connections each time, the result of the current code would appear to me to be too many open file descriptors and not errors on the connection itself or issues with reusing the connection since we're recreating the transport each time.\r\n\r\nI actually think we should change util.HTTPClient significantly. To me it should use something closer to DefaultTransport in https://golang.org/src/net/http/transport.go that actually has reasonable timeouts for the handshake, connecting, reading, etc. I also think it should just set DisableKeepAlives to true and should have a second method util.PersistentHTTPClient that uses keep alives since we do really want the connections to stay open for things like Loggly. \r\n\r\nIt's also useful to note that these util.HTTPClient connections are or should be just going to our server on localhost, which itself has no timeouts. So this could easily be a major cause of the file descriptor issues, but I don't see it as a cause of the issues with the connections described here unless I'm missing something.\r\n\r\nEither way it's clearly a crucial area, so great catch. I just logged the more general issue here:\r\n\r\nhttps://github.com/getlantern/lantern/issues/2491"}}