[ejabberd] mnesia corruption with concurrent ejabberdctl usage

Martin Langhoff martin.langhoff at gmail.com
Mon Dec 28 22:08:05 MSK 2009


On Mon, Dec 28, 2009 at 7:18 PM, Badlop <badlop at gmail.com> wrote:
> I don't know if your ejabberdctl shell script has the problem
> described in this thread/message:
> http://lists.jabber.ru/pipermail/ejabberd/2009-September/005351.html

That sure looks like the smoking gun. To check I am understanding this right

 - It is not safe to run many ejabberdctl instances because they
always use the same "connection name"

 - If we give a truly random connection name, no overlaps happen, but
erl will leak handles/processes/whatever

 - So a small pool of names with some locking may work? Modern distros
carry flock, so we could say (pseudo-shell):

   MAXCONNECTIONS=100
   CONNLOCKDIR=/var/lock/ejabberd/ejabberdctl

   for CONNID in 1..$MAXCONNECTIONS; do
       if flock -n "$CONNLOCKDIR/ctl-ejabberd-$CONNID at localhost" \
           erl -sname "ctl-ejabberd-$CONNID at localhost" ... ; then
           break

cheers,



m
-- 
 martin.langhoff at gmail.com
 martin at laptop.org -- School Server Architect
 - ask interesting questions
 - don't get distracted with shiny stuff  - working code first
 - http://wiki.laptop.org/go/User:Martinlanghoff


More information about the ejabberd mailing list