mattbaird/elastigo

Possible file descriptor leaks?

Closed this issue · 2 comments

jchv commented

I have been debugging issues with file descriptors leaking in an application, and looking at Elastigo I'm wondering if there's a chance that Elastigo may be leaking some FDs.

For example, In lib/coreget.go:94 inside of ExistsBool, an HTTP request is executed, but the Body of the response is never closed, presumably leaving a dangling connection for some period of time. It looks like this may also be an issue in some other functions, i.e. get itself calls DoCommand which returns the Body of a Response, but it is never closed.

Am I mistaking, or are these resource leaks?

hi @johnwchadwick we wrapped the http stuff in an api that looks a bit like the Go stuff so while it looks like core Go http calls, it's actually Elastigo code. follow the path to

defer res.Body.Close()

and you'll see the defer close on the actual underlying connection.

cheers!

jchv commented

Oh, I missed that bit. Thanks for the explanation.