Hi Willy,

Le Samedi 9 Janvier 2010 14:01:36, Willy Tarreau a écrit :
> (...)
> > One thing I suspect would be that we simply fail to free lots of
> allocated memory and that the last pool_alloc() returns NULL due
> to lack of memory, hence the segfault. But I also suspect that we
> *may* end up corrupting some lists or pools if we reuse some data
> across two consecutive requests. Anyway I've committed the fix.

This doesn't directly concern this issue but I've tried to follow all the 
pool_alloc2/pool_free2 calls in the code to track memory leaks.
I've found one which only happens when there's already no more memory when 
allocating a new appsession cookie :

--- haproxy-1.4-dev6/src/proto_http.c   2010-01-10 00:14:47.000000000 +0100
+++ haproxy-1.4-dev6-freememory/src/proto_http.c        2010-01-10 
00:15:16.000000000 +0100
@@ -5954,6 +5954,7 @@
                        if ((asession->sessid = pool_alloc2(apools.sessid)) == 
NULL) {
                                Alert("Not enough Memory 
process_srv():asession->sessid:malloc().\n");
                                send_log(t->be, LOG_ALERT, "Not enough Memory 
process_srv():asession->sessid:malloc().\n");
+                               t->be->htbl_proxy.destroy(asession);
                                return;
                        }
                        memcpy(asession->sessid, t->sessid, 
t->be->appsession_len);
@@ -5963,6 +5964,7 @@
                        if ((asession->serverid = pool_alloc2(apools.serverid)) 
== NULL) {
                                Alert("Not enough Memory 
process_srv():asession->sessid:malloc().\n");
                                send_log(t->be, LOG_ALERT, "Not enough Memory 
process_srv():asession->sessid:malloc().\n");
+                               t->be->htbl_proxy.destroy(asession);
                                return;
                        }
                        asession->serverid[0] = '\0';

-- 
Cyril Bonté

Reply via email to