[ejabberd] strange registration error

Jan Koum jan.koum at gmail.com
Thu Nov 12 09:48:40 MSK 2009


On Mon, Oct 26, 2009 at 11:21 AM, Jan Koum <jan.koum at gmail.com> wrote:

>
>
> On Mon, Sep 21, 2009 at 1:53 AM, Badlop <badlop at gmail.com> wrote:
>
>> 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`
>>  PNUM=$[ $MINUTE + $SECOND ]
>>  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.
>>
>
>
> on freebsd i am using jot(1) -- seems to work so far:
>
> # common control function
> RANDOM=`jot -r 1 1 100`
> ctl ()
> {
>     COMMAND=$@
>     $EXEC_CMD "$ERL \
>       $NAME ctl-${RANDOM}-${ERLANG_NODE} \
>
> -- yan
>


LOL, looks like a random number between 1 and 100 is NOT enough for me:

Nov 11 20:51:51 im101 last message repeated 8 times
Nov 11 20:52:09 im101 last message repeated 5 times
Nov 11 20:52:10 im101 epmd: epmd: node name already occupied ctl-46-ejabberd
Nov 11 20:52:10 im101 epmd: epmd: epmd running - daemon = 1
Nov 11 20:52:38 im101 last message repeated 7 times
Nov 11 20:53:21 im101 last message repeated 12 times
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20091111/559329f2/attachment-0001.html>


More information about the ejabberd mailing list