On Tue, May 15, 2012 at 11:14:53AM +0200, Lars Ellenberg wrote:
> On Mon, May 14, 2012 at 05:44:55PM +0200, Lars Ellenberg wrote:
> > > By the way, I suspect Lars' suggestion would work fine. I would
> > > certainly explain what the "better" patch is in the comments when you
> > > apply this one.
> Hm. Looks like it *does* explode (aka segfault)
Continuing my monologue ...
it may just have been incomplete.
The patch below seems to work just fine.
I managed to occasionally trigger the
"Attempt to remove timeout (%u) with NULL source"
message, but I have seen that one without the patch as well,
so that may just be some other oddity somewhere:
double removal of timeout resources ;-)
We can find and drop those later,
they look harmless enough.
I do not see any memleak anywhere anymore with this patch applied.
Comments/review/testing welcome.
# HG changeset patch
# User Lars Ellenberg <[email protected]>
# Date 1337066453 -7200
# Node ID e63dd41f46b7bd150a23a62303bde6be78305c9c
# Parent 63d968249025b245e38b1da6d0202438ec45ebf3
[mq]: potential-fix-for-timer-leak
diff --git a/lib/clplumbing/GSource.c b/lib/clplumbing/GSource.c
--- a/lib/clplumbing/GSource.c
+++ b/lib/clplumbing/GSource.c
@@ -1507,6 +1507,7 @@
g_source_set_callback(source, function, data, notify);
append->gsourceid = g_source_attach(source, NULL);
+ g_source_unref(source);
return append->gsourceid;
}
@@ -1517,14 +1518,12 @@
GSource* source = g_main_context_find_source_by_id(NULL,tag);
struct GTimeoutAppend* append = GTIMEOUT(source);
- g_source_remove(tag);
-
if (source == NULL){
cl_log(LOG_ERR, "Attempt to remove timeout (%u)"
" with NULL source", tag);
}else{
g_assert(IS_TIMEOUTSRC(append));
- g_source_unref(source);
+ g_source_remove(tag);
}
return;
--
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/