HomeClusterLabs Projects

Fix: crmd: don't segfault on shutdown when using heartbeat

Description

Fix: crmd: don't segfault on shutdown when using heartbeat

The interface to use G_main_add_ll_cluster() was broken (incomplete)
since it was introduced.
->delete() does cleanup and free most of it, but it does not
actually remove and destroy the corresponding GSource, so the next
prepare/check iteratioin would find a corrupt (because partially
freed) GSource, and segfault.

So better use ->delete only after g_main_loop_quit().

Apparently one was supposed to store the GSource as returned by
G_main_add_ll_cluster(), and g_source_destroy() that "by hand".

But no-one ever did this, not even in the old hb code when this was
introduced.

Note that fsa_cluster_conn was set as an "alias" to cluster->hb_conn
in do_ha_control() right after crm_cluster_connect(), and only
happens to still point at that object, because do_ha_control() does
not reset it to NULL after crm_cluster_disconnect() above does
reset cluster->hb_conn to NULL.
Not sure if that's something to cleanup, too.

I'll try to fix this up in heartbeat proper, so ->delete
will actually remove, and destroy, and unref, and free this thing.
Doing so after g_main_loop_quit() is valid with both old,
and eventually fixed heartbeat.

If we introduce the "by hand" destroy/remove/unref,
this may break again (double free...) once heartbeat is fixed :-(

Details

Provenance
Lars Ellenberg <lars@linbit.com>Authored on Oct 18 2013, 9:11 AM
Lars Ellenberg <lars.ellenberg@linbit.com>Committed on Oct 18 2013, 9:38 AM
Parents
rP1d8b74bebb85: Merge pull request #377 from davidvossel/ipc_buf_size_detection
Branches
Unknown
Tags
Unknown

Event Timeline