[ejabberd] thread safety of MUC restoration in a cluster

Daniel Dormont dan at greywallsoftware.com
Fri Mar 4 20:48:43 MSK 2011


Hi,

According to http://www.process-one.net/docs/ejabberd/guide_en.html#htoc48 and my own testing, when a node hosting a MUC is shut down, its entry in muc_online_room is removed, but not in muc_room if the room is configured as persistent. Then whenever any client, connected to another node, tries to join the room, it will restore the room on the new client's node.

My question is: is this thread-safe? Suppose that multiple clients on one of the remaining live nodes, or better yet multiple live nodes, all send presences to the MUC at the same time. Is it guaranteed that the MUC will be restored cleanly on exactly one of the nodes?

I'm relatively new to Erlang, but I started looking at the code and the reason for my question is that it seems to me that since the route function in mod_muc executes a dirty read in muc_online_room (line 474) before creating and registering the new room, there's a chance for duplicate rooms being launched.  Forgive me if I'm misreading.

Note I am running ejabberd 2.1.6 and I have configured table muc_online_room as "RAM copy" on both nodes.

thanks,
Dan




More information about the ejabberd mailing list