coreos/go-etcd — pull request #34 by jagregory (2013-09-18 00:32:20+00:00)
Title: Close response body when there's an Internal Server Error

There's an edge case where when the server responds with a 500 error and we've exceeded our retry count, the response body won't be closed leading to a leaked file descriptor.

It's quite hard to reproduce as it requires your etcd server to send 500 errors, which in my case was caused by the raft server timing out in a cluster due to [etcd#176](https://github.com/coreos/etcd/issues/176).

When my server was in an inconsistent state, it would eventually run out of file descriptors because my services would be hitting etcd and leaking a descriptor for every 500 error received.