2010/11/14 Lars Ellenberg <lars.ellenb...@linbit.com>:
> On Tue, Nov 09, 2010 at 06:06:30PM +0900, Keisuke MORI wrote:

>> Ok, then let's just drop the changeset.
>>
>> I agree that srand should not be called many times,
>> but I would rather prefer to just keep the existing behavior
>> since there have been no problems with that so far.
>
> Ok, I'll revert it for now.

Thanks, I confirmed that the problem went away.

>
> But I'd rather have it working there.
> Would this patch to the cib do the right thing?

The patch actually didn't work. I've looked into the code more and now
I realized that the existence of the mainloop is not the issue here;
the g_main_loop_is_running() _always_ fails when NULL is passed.

glue/lib/clplumbing/cl_random.c:
---- ---- ---- ---- ---- ---- ---- ---- ----
static void
get_more_random(void)
{
        if (randgen_scheduled || IS_QUEUEFULL) {
                return;
        }
        if (g_main_loop_is_running(NULL)) {
                randgen_scheduled = TRUE;
                Gmain_timeout_add_full(G_PRIORITY_LOW+1, 10, add_a_random, 
NULL, NULL);
        }
}
---- ---- ---- ---- ---- ---- ---- ---- ----


By looking at the source code of glib it looks like this:
http://git.gnome.org/browse/glib/tree/glib/gmain.c#n3157
---- ---- ---- ---- ---- ---- ---- ---- ----
gboolean
g_main_loop_is_running (GMainLoop *loop)
{
  g_return_val_if_fail (loop != NULL, FALSE);
  g_return_val_if_fail (g_atomic_int_get (&loop->ref_count) > 0, FALSE);

  return loop->is_running;
}
---- ---- ---- ---- ---- ---- ---- ---- ----

I'm wondering the 'get_more_random()' logic had ever worked before.

So the proper fix here would be, in my opinion,
just removing the 'get_more_random()' logic in the cluster-glue code.
It does not make sense for me that the g_mainloop is required just for
getting a random value:)

The Heartbeat code should still support the current version of
cluster-glue, so I think that the current code in the repository is
just good for the coming 3.0.4.


>> Any other backlogs to release the heartbeat packeage?
>> I would look forward to be released it soon!
>
> Me too. Alas ...
> We try to get it out until next Friday (19th November)

Great!
Thank you for all your effort for the release!

-- 
Keisuke MORI
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to