ejabberd - Comments for "MUC room creation race?" https://www.ejabberd.im/node/4585 en Experimental patch https://www.ejabberd.im/node/4585#comment-57271 <p>Try this patch for ejabberd 2.1.x:<br /> <noindex><a href="http://tkabber.jabber.ru/files/badlop/4585-muc-creation-race.diff" title="http://tkabber.jabber.ru/files/badlop/4585-muc-creation-race.diff" rel="nofollow" >http://tkabber.jabber.ru/files/badlop/4585-muc-creation-race.diff</a></noindex><br /> And tell me if it solves the problem or not.</p> Mon, 02 May 2011 19:10:17 +0000 mfoss comment 57271 at https://www.ejabberd.im I've bundled up the program https://www.ejabberd.im/node/4585#comment-57173 <p>I've bundled up the program that can demonstrate this problem. On my ubuntu box, this will get it built:</p> <div class="codeblock"><code>sudo apt-get install check libexpat1-dev <p>mkdir test<br />cd test</p> <p># see <noindex><a href="http://code.stanziq.com/strophe/" title="http://code.stanziq.com/strophe/" rel="nofollow" >http://code.stanziq.com/strophe/</a></noindex><br />git clone git://code.stanziq.com/libstrophe<br />wget <noindex><a href="http://headache.hungry.com/~seth/xmpp-nagios-check.tar.bz2" title="http://headache.hungry.com/~seth/xmpp-nagios-check.tar.bz2" rel="nofollow" >http://headache.hungry.com/~seth/xmpp-nagios-check.tar.bz2</a></noindex><br />tar xvf xmpp-nagios-check.tar.bz2</p> <p>cd libstrophe<br />patch -p1 &lt; ../xmpp-nagios-check/strophe.diff<br />./bootstrap.sh<br />./configure<br />make</p> <p>cd ../xmpp-nagios-check<br /># edit xmpp-nagios-check.c and set USER* and PASS* at the top<br />make</p> <p>./xmpp-nagios-check -H host0 -H host1 -j chat.something.com -v -r</p></code></div> <p>It may take several runs to see the problem. If it works, it exits after about 10 seconds. If it fails (and demonstrates the race), it will keep running for a couple minutes.</p> Tue, 22 Mar 2011 15:34:28 +0000 sethalves comment 57173 at https://www.ejabberd.im It may be a race as you https://www.ejabberd.im/node/4585#comment-57158 <p>It may be a race as you thought, in mod_muc.erl line 474. The code is like this:</p> <p>1. IF the room is not stored in the DB<br /> 2... THEN<br /> 3....... create the room<br /> 4....... and store the room in the DB<br /> 5... ELSE<br /> 6....... send this stanza to the existing room</p> <p>In the code, the DB read operation of step 1 and the write operation in step 4 are not a "DB atomic transaction", but as mod_muc in a node is run by a single process, it's guaranteed to be atomic in a single node. However, probably there isn't guarantee with several nodes, as each node has a different process.</p> <p>The mnesia DB table used in that code is 'muc_online_room'. Have you configured that mnesia table to be shared among the nodes?</p> <p>Maybe the problem happens like this: while the first node is running step 2, the second node is evaluating 1 and entering step 2 too.</p> <p>Does it make sense to you all that I said?</p> Sat, 19 Mar 2011 21:52:54 +0000 mfoss comment 57158 at https://www.ejabberd.im