possible memory leak issue...

13 views
Skip to first unread message

pavera

unread,
Mar 21, 2012, 3:03:55 PM3/21/12
to httplib2-dev
I'm creating a long running process using httplib2 which makes
periodic requests to a REST api based on events that occur in the
daemon process.

There appears to be a rather large memory leak in this scenario if the
web server to which I'm connecting has KeepAlive enabled. Watching an
strace of my process, every request opens a new socket which it never
closes, so each request uses a new fd in strace. Eventually, the GC
in python will come along and clean this up and close all the fds,
normally it counts up to 30-35 before it closes all of them, starting
over at fd=5 after the collection run. However this fd usage appears
to allocate more RAM to the python process heap, which is never
freed. Memory use grows continuously until the machine is out of
RAM. Even though the fd counter goes back to 5 after a collection
run, it appears to continue to allocate additional ram for each fd as
they are "reused".

If KeepAlive is disabled on the web server, then every request uses fd
5 (or the lowest free fd available), and memory use stays constant.

I can post this as an issue if you'd like with strace runs, etc, but
thought I'd post here first to see if this is my fault for a misuse of
the library or something else first?

-Tom
Reply all
Reply to author
Forward
0 new messages