Hi, Here is a repor<http://archives.seul.org/libevent/users/Apr-2010/msg00003.html>t about memory leak with connection keepalive. http://archives.seul.org/libevent/users/Apr-2010/msg00003.html
I observed the same problem in my environment. I took some time to trace the cause. Seems like it's really a bug. Does anybody help me verify it and give a possible fix? When the reply is sent, evhttp_send_done() invokes evhttp_associate_new_request_with_connection() to attach a new evhttp_request if the connection is keep alived. When the client times out the connection, evhttp_read() invokes evhttp_connection_fail with EVCON_HTTP_EOF to indicate the connection reaches EOF. evhttp_connection_fail() checks the reqeust attached by evhttp_associate_new_request_with_connection() with userdone and determines to remove it from the queue without free. So memory leak comes. Even if there is some comments in evhttp_connection_fail(), I don't know why it should check against userdone and then remove the request from the queue. If the connection is failed and freed, shouldn't evhttp de-activate all events and then schedule callbacks? If so, who will access the request after the free of connection and why libevent keeps the pointer to the request? best regards, hanzhu
_______________________________________________ Libevent-users mailing list Libevent-users@monkey.org http://lists.monkey.org:8080/listinfo/libevent-users