After upgrading ejabberd from 2.1.3 to 2.1.8 `ejabberdctl` suddenly refused to work, saying "nodedown", while ejabberd itself started and works as usual. With Holger at ejabberd@conference.jabber.ru we've tracked down roots of the problem: 1) FreeBSD's /bin/sh initializes exported variable with empty value if it was not previously set: $ printenv | grep FOO $ export FOO $ printenv | grep FOO _=FOO FOO= 2) `ejabberdctl` script exports unset variable ERL_EPMD_ADDRESS 3) `epmd` treats ERL_EPMD_ADDRESS='' as ERL_EPMD_ADDRESS='127.0.0.1' and listens only on localhost 4) `erl` called by `ejabberdctl` firts gets local hostname, tries to resolve it via gethostbyname and connects to `epmd` on that IP. But if you don't have local hostname as alias in /etc/hosts or /usr/local/etc/ejabberd/inetrc it will fail, since DNS record usually does not point to 127.0.0.1. Fix: Possible patch (not tested) for rc-script attached. Running epmd `only` on 127.0.0.1 is good for security, but clustering requires `epmd` to listen on address accessible from other nodes. Also, pkg-message should mention that `ejabberdctl` will not work with nodename other than "ejabberd@localhost", if Erlang does not resolve local machine's short hostname to address on which `epmd` is able to accept connections. In case of single node most preferred way to achieve this is to leave `epmd` listening on 127.0.0.1 and add $(hostname -s) as alias for 127.0.0.1 in /usr/local/etc/ejabberd/inetrc Patch attached with submission follows: How-To-Repeat: Install ejabberd, set "ejabberd_nodename" to "ejabberd@$(hostname -s)", start ejabberd and execute "ejabberdctl --node ejabberd@(hostname -s) status"
Responsible Changed From-To: freebsd-ports-bugs->ashish Fix synopsis and assign.
http://erlang.org/pipermail/erlang-patches/2011-July/002225.html
ashish 2011-09-19 15:52:30 UTC FreeBSD ports repository Modified files: net-im/ejabberd Makefile net-im/ejabberd/files ejabberd.in Log: - Explicitly specify ERL_EPMD_ADDRESS to ejabberd rc.d script during startup to avoid unexpected behaviour. - Bump PORTREVISION PR: ports/158357 Submitted by: Maxim Ignatenko <gelraen.ua@gmail.com> Revision Changes Path 1.45 +1 -0 ports/net-im/ejabberd/Makefile 1.7 +3 -2 ports/net-im/ejabberd/files/ejabberd.in _______________________________________________ cvs-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/cvs-all To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
State Changed From-To: open->closed Committed, with minor changes. Thanks!
Hi, thanks for figuring this out... unfortunately the fix in this PR has = not solved the issue for my installation. I asked the question on the ejabberd forum, too, which has a bunch more = details on my configuration: http://www.ejabberd.im/node/4941 but there are no answers there... I updated ejabberd port to 2.1.8_1 this morning, manually killed off = epmd and ejabberd/beam, set the ejabberd_epmd_address to the IP of the = host "lorax". Then I restarted it. I cannot remote control it though. = The only change in configuration since the prior version of ejabberd I = had installed is the addition of the epmd address setting in rc.conf. = It was working fine up until this upgrade. I also tried it by leaving = the epmd address setting to the default (empty) but the same results. [root@lorax]~# /usr/local/etc/rc.d/ejabberd start Starting ejabberd. [root@lorax]~# /usr/local/etc/rc.d/ejabberd status ejabberd is not running. [root@lorax]~# ps axuw | grep ejabber ejabberd 6989 0.0 0.0 3492 1112 ?? S 9:26AM 0:00.00 = /usr/local/lib/erlang/erts-5.8.4/bin/epmd -daemon ejabberd 11854 0.0 1.1 64872 42180 ?? S 9:26AM 0:04.21 = [beam.smp] ejabberd 35603 0.0 0.0 3492 980 ?? Is 9:26AM 0:00.18 = inet_gethost 4 ejabberd 37792 0.0 0.0 3492 1216 ?? I 9:26AM 0:00.00 = inet_gethost 4 root 3566 0.0 0.0 3536 1168 2 S+ 9:28AM 0:00.00 grep = ejabber [root@lorax]~# grep ejabberd /etc/rc.conf=20 ejabberd_enable=3D"YES" ejabberd_node=3D"ejabberd@lorax" ejabberd_epmd_address=3D"206.112.95.1" [root@lorax]~# host lorax lorax.kcilink.com has address 206.112.95.1 lorax.kcilink.com mail is handled by 0 . [root@lorax]~# su ejabberd -c 'ejabberdctl --node ejabberd@lorax = reopen-log' Failed RPC connection to the node ejabberd@lorax: nodedown Commands to start an ejabberd node: start Start an ejabberd node in server mode debug Attach an interactive Erlang shell to a running ejabberd node live Start an ejabberd node in live (interactive) mode Optional parameters when starting an ejabberd node: --config-dir dir Config ejabberd: /usr/local/etc/ejabberd --config file Config ejabberd: = /usr/local/etc/ejabberd/ejabberd.cfg --ctl-config file Config ejabberdctl: = /usr/local/etc/ejabberd/ejabberdctl.cfg --logs dir Directory for logs: /var/log/ejabberd --spool dir Database spool dir: /var/spool/ejabberd --node nodename ejabberd node name: ejabberd@lorax [root@lorax]~#=20
Wouldn't you want to also pass the environment variable to the = status/start/stop command invocations of ejabberdctl as well? Otherwise = it only works on 127.0.0.1 -- i.e., you cannot set the rc.conf variable = and expect it to work.
Vick Khera writes: > Hi, thanks for figuring this out... unfortunately the fix in this PR has = > not solved the issue for my installation. > I asked the question on the ejabberd forum, too, which has a bunch more = > details on my configuration: > http://www.ejabberd.im/node/4941 but there are no answers there... > I updated ejabberd port to 2.1.8_1 this morning, manually killed off = > epmd and ejabberd/beam, set the ejabberd_epmd_address to the IP of the = > host "lorax". Then I restarted it. I cannot remote control it though. = > The only change in configuration since the prior version of ejabberd I = > had installed is the addition of the epmd address setting in rc.conf. = > It was working fine up until this upgrade. I also tried it by leaving = > the epmd address setting to the default (empty) but the same results. Hi Vick, I see the issue. I'll pass ERL_EPMD_ADDRESS to other invocations of the ejabberdctl as well in its rc.d script. I'll commit it in few hours. Sorry for the problem you've to face. Thanks -- Ashish SHUKLA | GPG: F682 CDCC 39DC 0FEA E116 20B6 C746 CFA9 E74F A4B0 freebsd.org!ashish | http://people.freebsd.org/~ashish/ Avoid Success At All Costs !!
On Fri, Sep 23, 2011 at 10:10 AM, Ashish SHUKLA <ashish@freebsd.org> wrote: > I see the issue. I'll pass ERL_EPMD_ADDRESS to other invocations of the > ejabberdctl as well in its rc.d script. I'll commit it in few hours. > > Sorry for the problem you've to face. > Thanks! I ended up doing the alias to localhost in the ejabberd config as recommended in the ticket. That works for me.
Vick Khera writes: > On Fri, Sep 23, 2011 at 10:10 AM, Ashish SHUKLA <ashish@freebsd.org> wrote: >> I see the issue. I'll pass ERL_EPMD_ADDRESS to other invocations of the >> ejabberdctl as well in its rc.d script. I'll commit it in few hours. >> >> Sorry for the problem you've to face. >> > Thanks! > I ended up doing the alias to localhost in the ejabberd config as > recommended in the ticket. That works for me. This is now committed. Thanks -- Ashish SHUKLA | GPG: F682 CDCC 39DC 0FEA E116 20B6 C746 CFA9 E74F A4B0 freebsd.org!ashish | http://people.freebsd.org/~ashish/ Avoid Success At All Costs !!