[ejabberd] strange registration error

Badlop badlop at gmail.com
Mon Sep 21 12:53:37 MSD 2009

2009/9/18 Jan Koum <jan.koum at gmail.com>:
> if i pass random/unique node name to ejabberdctl for registration, wouldn't
> that break things with mnesia db when i start/stop nodes?

Short answer: no problem with mnesia, but problem with infinite node names.

Long answer:
In ejabberd 2.1.0, the ejabberdctl script calls something like:
  erl -sname ctl-ejabberd at localhost ...

The problem with this is that you get the mentioned error if you try
to execute an ejabberdctl command when the script is still running for
a previous call.

As the node name of this erl node is not important, you could edit the
script and add a random part.
Quick example:
  NUM=`date +%s`
  erl -sname ctl-$NUM-ejabberd at localhost ...

The problem with this is not related to Mnesia.

But a problem appears if you periodically call this script: each time
you call it, ejabberdctl connects to the long-lasting ejabberd node
with a different node name. Those names are stored temporarily in the
node, and RAM consumption increases very slowly. Imagine 1 call every
minute * a few weeks of rrdtool callings --> problem.

A solution is to use a pseudo-random value: restricted to a small
amount of values that repeat periodically.
Quick example in Bash:
  MINUTE=`date +%M`
  SECOND=`date +%S`
  erl -sname ctl-$PNUM-ejabberd at localhost ...

I suspect this solution is not yet good enough for inclusion in main
ejabberd, so suggestions are welcomed.


More information about the ejabberd mailing list