From owner-freebsd-ports-bugs@FreeBSD.ORG Mon Jun 27 21:50:09 2011 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD88C1065670 for ; Mon, 27 Jun 2011 21:50:09 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 9AFD68FC1A for ; Mon, 27 Jun 2011 21:50:09 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p5RLo92l065212 for ; Mon, 27 Jun 2011 21:50:09 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p5RLo9hS065211; Mon, 27 Jun 2011 21:50:09 GMT (envelope-from gnats) Resent-Date: Mon, 27 Jun 2011 21:50:09 GMT Resent-Message-Id: <201106272150.p5RLo9hS065211@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Maxim Ignatenko Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87C96106566C for ; Mon, 27 Jun 2011 21:48:00 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 5ECB98FC18 for ; Mon, 27 Jun 2011 21:48:00 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p5RLm0FA042307 for ; Mon, 27 Jun 2011 21:48:00 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p5RLm0tQ042306; Mon, 27 Jun 2011 21:48:00 GMT (envelope-from nobody) Message-Id: <201106272148.p5RLm0tQ042306@red.freebsd.org> Date: Mon, 27 Jun 2011 21:48:00 GMT From: Maxim Ignatenko To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: ports/158357: Strange behaviour of epmd launched with ejabberd X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2011 21:50:09 -0000 >Number: 158357 >Category: ports >Synopsis: Strange behaviour of epmd launched with ejabberd >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Jun 27 21:50:09 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Maxim Ignatenko >Release: FreeBSD 7.3-STABLE >Organization: >Environment: >Description: 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. >How-To-Repeat: Install ejabberd, set "ejabberd_nodename" to "ejabberd@$(hostname -s)", start ejabberd and execute "ejabberdctl --node ejabberd@(hostname -s) status" >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: --- ejabberd.in.orig 2011-06-28 00:37:21.636314615 +0300 +++ ejabberd.in 2011-06-28 00:39:23.156814051 +0300 @@ -15,6 +15,7 @@ # ejabberd_enable=${ejabberd_enable-"NO"} ejabberd_node=${ejabberd_node-"ejabberd@localhost"} +ejabberd_epmd_address=${ejabberd_epmd_address-"127.0.0.1"} . /etc/rc.subr @@ -50,7 +51,7 @@ ejabberd_start() { echo "Starting $name." - su $EJABBERDUSER -c "$EJABBERDCTL --node $ejabberd_node start" + su $EJABBERDUSER -c "env ERL_EPMD_ADDRESS=\"${ejabberd_epmd_address}\" $EJABBERDCTL --node $ejabberd_node start" } ejabberd_stop() >Release-Note: >Audit-Trail: >Unformatted: