I've been seeing a FD leak issue in http.Client for a while now. I've read a lot of threads on this forum about issues that sound identical, all of which seem to have been resolved for the poster, but I'm still seeing the problem so I'm wondering if anybody else has had a similar problem and what they did about it.
Specifically, I'm running a service that executes a lot of HTTP requests (hundreds of thousands an hour). Slowly, over time, I can see that FDs build up until eventually I run out and have to restart the service. It doesn't seem to happen for every connection, but at the volume of requests I'm making it runs up pretty quickly.
Based on various things I've read, I'm doing the following things to try to guarantee these FDs get released, but to no avail:
- I am always calling rsp.Body.Close(),
- I am always consuming the response body, even if I don't do anything with it via: io.Copy(ioutil.Discard, rsp.Body)
- I have disabled keep-alive connections in http.Client (via the DisableKeepAlives property of Transport)
- I have disabled keep-alive connections in every individual request by setting req.Close = true,
- I am reusing the same http.Client instance for all these requests,
- I have even tried telling the underlying Transport to CloseIdleConnections after each request.
I've also noticed that the goroutines associated with those connections are also constantly increasing, blocked in an I/O wait state.
Is there something obvious I may be missing? I'm seeing this on go1.3.3 linux/amd64.
Thanks for any help,
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to