[ejabberd] strange registration error

Jan Koum jan.koum at gmail.com
Fri Sep 18 21:37:41 MSD 2009


On Fri, Sep 18, 2009 at 10:31 AM, Konstantin Khomoutov <
flatworm at users.sourceforge.net> wrote:

> Jan Koum wrote:
>
>   17/Sep/2009:15:27:36 HARDFAIL command:
>>>
>>>> [/home/jkoum/ejabberd-2.1.0_beta1/bin/ejabberdctl register xxx
>>>> s.example.netyyy] return: 1
>>>> {error_logger,{{2009,9,17},{15,27,33}},"Protocol: ~p:
>>>> register error:
>>>>
>>>>
>>>> ~p~n",["inet_tcp",{{badmatch,{error,duplicate_name}},[{inet_tcp_dist,listen,1},{net_kernel,start_protos,4},{net_kernel,start_protos,3},{net_kernel,init_node,2},{net_kernel,init,1},{gen_server,init_it,6},{proc_lib,init_p,5}]}]}
>>>>
>>>> while end result is the same, i am curious if this different behavior is
>>>> normal or is this some bug we are triggering?
>>>>
>>>>  This error has nothing to do with user registration,
>>> at least not directly. See [1] for explanations.
>>>
>>> 1. http://www.ejabberd.im/error/duplicate_name
>>>
>>
> > i looked at the url but still a bit confused... it says you get this
> > error when trying to start another instance of ejabberd, but i am not
> > starting another instance of ejabberd, just trying to register
> > a user..
> The problem is possibly not related to starting *ejabberd itself*
> multiple times, but rather to staring two or more instances of ejabberdctl
> at the same time.
>
> My guess goes like this: ejabberdctl is a Unix shell script script which
> ends up calling the Erlang emulator to run the ejabberd_ctl module after
> setting up the environment for this. The erl process is run with either the
> -name or the -sname flag which turns the process into a distributed Erlang
> node (see [1]). Since Erlang nodes must be unique across their network, the
> Erlang subsystem will not let you run more than one node with the same
> name/short name. So if you have a race between ejabberdctl runs, the second
> one will fail.
> You can easily see how this occurs:
> $ erl -sname foo &
> $ erl -sname foo
> (see it crash, scroll up to see that badmatch error)
> $ rm erl_crash.dump
> $ fg
> (press ctrl-g, then enter q and hit return)
>
> The solution could be to modify the ejabberdctl code to make random (or
> predictably unique) node name for -name/-sname.
>
> 1. http://www.erlang.org/doc/man/erl.html
>
> P.S.
> Please, don't top-post, see
> http://www.catb.org/~esr/jargon/html/T/top-post.html<http://www.catb.org/%7Eesr/jargon/html/T/top-post.html>
>
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd
>


lol.. all of sudden i get flashbacks of usenet circa 1996:)  what about
in-line responses?:)

anyways, yes you are correct -- it is a race condition.  i added random
sleep/wait for the script to retry if it detects a collision with another
ejabberdctl.

if i pass random/unique node name to ejabberdctl for registration, wouldn't
that break things with mnesia db when i start/stop nodes?

-- yan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20090918/fe4145cc/attachment.html>


More information about the ejabberd mailing list