From nobody@FreeBSD.org  Tue Feb 21 12:57:41 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 5D1EA106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 21 Feb 2012 12:57:41 +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 32F838FC16
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 21 Feb 2012 12:57:41 +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 q1LCvedJ002532
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 21 Feb 2012 12:57:40 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id q1LCveCk002531;
	Tue, 21 Feb 2012 12:57:40 GMT
	(envelope-from nobody)
Message-Id: <201202211257.q1LCveCk002531@red.freebsd.org>
Date: Tue, 21 Feb 2012 12:57:40 GMT
From: Neil Darlow <neil@darlow.co.uk>
To: freebsd-gnats-submit@FreeBSD.org
Subject: ejabberdctl fails to communicate with ejabberd process
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         165360
>Category:       ports
>Synopsis:       net-im/ejabberd: ejabberdctl fails to communicate with ejabberd process
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    ashish
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 21 13:00:20 UTC 2012
>Closed-Date:    
>Last-Modified:  Sat Mar 30 08:40:03 UTC 2013
>Originator:     Neil Darlow
>Release:        RELENG_9_0
>Organization:
>Environment:
FreeBSD bumblebee.darlow.co.uk 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Thu Jan  5 04:54:45 GMT 2012     root@bumblebee.darlow.co.uk:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
With ejabberd-2.1.9 installed and configured it is possible to start ejabberd with /usr/local/etc/rc.d/ejabberd start but /usr/local/etc/rc.d/ejabberd stop fails to stop ejabberd with a RPC error. Similarly /usr/local/etc/rc.d/ejabberd status indicates the node is not running when it clearly is.

/etc/rc.conf.local:
ejabberd_enable="YES"
ejabberd_node="ejabberd@bumblebee"

/etc/hosts:
192.168.1.2             bumblebee.darlow.co.uk bumblebee

hostname -s
bumblebee


>How-To-Repeat:
1) Start ejabberd
bumblebee# /usr/local/etc/rc.d/ejabberd start
Starting ejabberd.

bumblebee # ps ax
 2185  ??  S      0:00.00 /usr/local/lib/erlang/erts-5.8.5/bin/epmd -daemon
 2187  ??  S      0:03.18 [beam.smp]
 2188  ??  Ss     0:00.02 /usr/local/lib/erlang/lib/ssl-4.1.6/priv/bin/ssl_esoc
 2189  ??  Is     0:00.01 inet_gethost 4
 2190  ??  I      0:00.00 inet_gethost 4

2) Query ejabberd status
bumblebee# /usr/local/etc/rc.d/ejabberd status
ejabberd is not running.

bumblebee# ps ax
 2185  ??  S      0:00.00 /usr/local/lib/erlang/erts-5.8.5/bin/epmd -daemon
 2187  ??  S      0:03.21 [beam.smp]
 2188  ??  Ss     0:00.02 /usr/local/lib/erlang/lib/ssl-4.1.6/priv/bin/ssl_esoc
 2189  ??  Is     0:00.01 inet_gethost 4
 2190  ??  I      0:00.00 inet_gethost 4

3) Attempt to stop ejabberd
bumblebee# /usr/local/etc/rc.d/ejabberd stop
Stopping ejabberd.
Failed RPC connection to the node ejabberd@bumblebee: 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@bumblebee

ejabberd not running?

4) Verify that ejabberd is operational
bumblebee# netstat -an
tcp4       0      0 *.5280                 *.*                    LISTEN
tcp4       0      0 *.5269                 *.*                    LISTEN
tcp4       0      0 *.5222                 *.*                    LISTEN

>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->ashish 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Feb 22 03:42:44 UTC 2012 
Responsible-Changed-Why:  
Fix synopsis and assign. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=165360 

From: ashish@FreeBSD.org (Ashish SHUKLA)
To: bug-followup@FreeBSD.org,neil@darlow.co.uk
Cc:  
Subject: Re: ports/165360: net-im/ejabberd: ejabberdctl fails to communicate with ejabberd process
Date: Sat, 19 May 2012 03:54:48 +0530

 --=-=-=
 Content-Type: text/plain
 Content-Transfer-Encoding: quoted-printable
 
 Hi,
 
 I've updated net-im/ejabberd port to 2.1.11. Could you please check if it
 solves your problem?
 
 Thanks
 =2D-=20
 Ashish SHUKLA      | GPG: F682 CDCC 39DC 0FEA E116  20B6 C746 CFA9 E74F A4B0
 freebsd.org!ashish | http://people.freebsd.org/~ashish/
 
 Sent from my Emacs
 
 --=-=-=
 Content-Type: application/pgp-signature
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.18 (FreeBSD)
 
 iQIcBAEBCgAGBQJPtswwAAoJEMdGz6nnT6SwWEwP/izds0WBUK6jdIjnFFJ5cWEn
 SvbHdDmLFLVVP9eX5lm/P/KY05szAdupQXFT8Z1Ep3Pf36NpYXLCRSDBoy3Hy1Rs
 B7iYzsgvsoW1+euvp+AXIKXuRr8rR9nFIROPOOTc9NEX8iTNm1zwALgXLUbKzJGa
 GydZTRcMK0mSajQM9pVEuz/vWKPVQC5GEwOz5fO+kVxeWXFxDSP4Twm9doHh5TLz
 bnnPBcxkdAFQZrOj8+bP6yS2fGvsWOHMxOHXsZjRUpnYwZCg/Nd8xBu0jFgSrMdo
 9dqeMN8Sy6eXY87f+06xKBHeN/1bCtVgGMHws4tBqafzn6jX+4FYvZx7C3WDRQlh
 qkKIUl9AEFm6XIBvSvN1CvxTBp/Ien0WINe0q3O7AST+zvGPVAPYWnf0NxlHi50J
 H6AkJ4NNq5+0RWuhcpAskFSdjadiL04DnPzwwOYpf5gbtMU9AqnZs6+YfHghqO+e
 mPTX0s06/zhPiNz35ROsRGOASozuSK//e/guskEyBKTYn2wSw6LpSvYoK44KJJ++
 eFlUjpchedAQP3BNr7ZeGVdbqU9GcpB/wPKAwTufjTlxawIh8PlyQi7MjupLTYjf
 2nWyuMUgFMIffwqtbxU5vriutrf+/HIxElP91HxE1b5Lq5tZuPVwkDDdhUW+Ki4/
 nD5oIGgyZr9POu7M5llU
 =F81v
 -----END PGP SIGNATURE-----
 --=-=-=--

From: Neil Darlow <neil@darlow.co.uk>
To: Ashish SHUKLA <ashish@freebsd.org>
Cc: bug-followup@freebsd.org
Subject: Re: ports/165360: net-im/ejabberd: ejabberdctl fails to communicate with ejabberd process
Date: Tue, 22 May 2012 11:04:02 +0100

 Hi Ashish,
 
 No, the update to ejabberd-2.1.11 has no effect. The problem still persists.
 
 Regards,
 Neil Darlow

From: ashish@freebsd.org (Ashish SHUKLA)
To: Neil Darlow <neil@darlow.co.uk>
Cc: bug-followup@freebsd.org
Subject: Re: ports/165360: net-im/ejabberd: ejabberdctl fails to communicate with ejabberd process
Date: Tue, 22 May 2012 16:58:22 +0530

 --=-=-=
 Content-Type: text/plain
 Content-Transfer-Encoding: quoted-printable
 
 Neil Darlow writes:
 > Hi Ashish,
 
 > No, the update to ejabberd-2.1.11 has no effect. The problem still persis=
 ts.
 
 Hi Neil,
 
 Okay, thanks for the update. I'm away from my FreeBSD host. I'll look
 at it when I'm back next week.
 
 Thanks
 =2D-=20
 Ashish SHUKLA      | GPG: F682 CDCC 39DC 0FEA E116  20B6 C746 CFA9 E74F A4B0
 freebsd.org!ashish | http://people.freebsd.org/~ashish/
 
 Sent from my Emacs
 
 --=-=-=
 Content-Type: application/pgp-signature
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
 
 iQIcBAEBCgAGBQJPu3hWAAoJEMdGz6nnT6SwUBoP/RevtIc7CoAnxNNOjyzZg7Gx
 ka5oPzpto94tbZQVSLO4Q5a9jJNdH/G0FilkBiNEnjcNFlDkmTHTwmwOt4MF8sHe
 DBoBb/GigFoVW1YbxzKlz38obhJsbUEjleoNBDv1vDydjC3NMCcuxbWrOrrhw4M2
 7yxdHzyPMao70CYfwkO8FaYiszL8uJ2cZfEuTc/gkymTDX/dKNZ4hW4x5VfKsBXL
 KVG2OohS/YBWd8jjgfSfYbHtLQw508RZvuBz4pk9ZovlKUowGSbT5xPBblMmaIGH
 HVw0T3PG8BDKPuntuVR2NI2NuUpCr1r62CxPWNy90x+CPNZGJHp2E3OdfCn1mevr
 Nqw7gvsxBRQQ/OCW0CPQ8wY6sTuM05oW4Vp3FltsNWVr89f18WtsdONnESfjvYOO
 VM1djQatoY/nUPpXlJHZTpgx8egictYFKaohKTfv1qfGkBFWtYUW1mrFAJvRrybJ
 fffA0XThILqmjPAvVcyj0hTT8lwgeVFL9TXpUkI1XXnCejOhzSLRN+TVxXwHgAN0
 gT2q632vFeBs0s39b/CcS+D/tmb2tY6ydhDhWfrVjm5TiGb2KW3lHCyV1LG2JFbC
 YPhfzqet6RFDLYEJrWBq03HEZN1cB7+JCku3gV1ZYc2nuWfy6DdKmV8tfjrQNrOA
 Edn/2g1T1NQ+SCzZudFr
 =AT1w
 -----END PGP SIGNATURE-----
 --=-=-=--

From: Neil Darlow <neil@darlow.co.uk>
To: bug-followup@freebsd.org, neil@darlow.co.uk
Cc:  
Subject: Re: ports/165360: net-im/ejabberd: ejabberdctl fails to communicate with ejabberd process
Date: Thu, 28 Mar 2013 11:02:37 +0000

 The problem with RPC failure appears to be related to hostname resolution.
 
 Rather than using the ejabberd_epmd_address of 127.0.0.1, it works when this 
 is set to the IP address that your ejabberd@hostname nodename resolves to (the 
 hostname bit) in my case 192.168.1.2
 
 There are two problems I noticed at shutdown:
 
 1) ejabberd spawns epmd if it is not already running but it does not kill it 
 at shutdown.
 
 This can be fixed by using erlang's epmd script (add epmd_enable="YES" to a 
 preferred rc.conf file). To ensure correct startup and shutdown ordering it is 
 necessary to change ejabberd's # REQUIRE: line as follows:
 
 # REQUIRE: DAEMON epmd
 
 2) epmd will not respond to the -kill option in its shutdown command until all 
 registered Names are removed (the -relaxed_command_check option is not used 
 when epmd is started).
 
 This is compounded because, once ejabberd has been signalled to stop by 
 ejabberdctl, the epmd script shutdown command can be executed before ejabberd 
 has unregistered its Name with epmd. This causes epmd to fail shutdown.
 
 A solution is to query epmd for ejabberd's Name, during shutdown, repeatedly 
 for up to 10 seconds (on my 1.6GHz server it takes about 6 seconds) waiting 
 for ejabberd to unregister itself, after which epmd will shutdown cleanly.
 
 So, in summary:
 1) Add epmd_enable="YES" to a preferred rc.conf file
 2) Add ejabberd_epmd_address="a.real.ip.address" to a preferred rc.conf file
 3) The ejabberd control script requires changes as per this after-install 
 patch:
 --- /usr/local/etc/rc.d/ejabberd.orig   2013-03-28 10:19:25.000000000 +0000
 +++ /usr/local/etc/rc.d/ejabberd        2013-03-28 10:20:36.000000000 +0000
 @@ -2,7 +2,7 @@
  # $FreeBSD: ports/net-im/ejabberd/files/ejabberd.in,v 1.10 2012/11/17 06:00:26 
 svnexp Exp $
  
  # PROVIDE: ejabberd
 -# REQUIRE: DAEMON
 +# REQUIRE: DAEMON epmd
  # BEFORE: LOGIN
  # KEYWORD: shutdown
  
 @@ -58,8 +58,12 @@
  {
      echo "Stopping $name."
      if su $EJABBERDUSER -c "env ERL_EPMD_ADDRESS=\"${ejabberd_epmd_address}\" 
 $EJABBERDCTL --node $ejabberd_node stop"; then
 -#        sleep 2
 -#        killall -u ejabberd -kill
 +        SECS=0
 +        while /usr/local/bin/epmd -names |grep 'ejabberd' >/dev/null; do
 +                sleep 1
 +                SECS=$(expr $SECS + 1)
 +                [ $SECS -eq 10 ] && exit
 +        done
      else
          _run_rc_notrunning
      fi
 
 The timeout implementation could probably be cleaned-up but the logic works 
 well for me.
 
 Regards,
 Neil Darlow

From: ashish@FreeBSD.org (Ashish SHUKLA)
To: bug-followup@FreeBSD.org, Neil Darlow <neil@darlow.co.uk>
Cc:  
Subject: Re: ports/165360: net-im/ejabberd: ejabberdctl fails to communicate with ejabberd process
Date: Fri, 29 Mar 2013 18:59:56 +0530

 --=-=-=
 Content-Type: text/plain
 Content-Transfer-Encoding: quoted-printable
 
 Hi,
 
 First of all, thank you for your time in investigating this.
 
 On Thu, 28 Mar 2013 11:10:01 GMT, Neil Darlow <neil@darlow.co.uk> said:
 
 >  The problem with RPC failure appears to be related to hostname resolutio=
 n.
 =20
 >  Rather than using the ejabberd_epmd_address of 127.0.0.1, it works when =
 this=20
 >  is set to the IP address that your ejabberd@hostname nodename resolves t=
 o (the=20
 >  hostname bit) in my case 192.168.1.2
 
 I'm not sure if that's the real reason. From what I noticed in my testing f=
 ew
 minutes ago with ejabberd 2.1.11, and erlang 16.b[1], that if I run system
 epmd (i.e. $PREFIX/rc.d/epmd), it's able to register its name intermittentl=
 y,
 i.e.
 
 #v+
 % sudo /usr/local/etc/rc.d/epmd start
 % sudo /usr/local/etc/rc.d/ejabberd start
 % sudo /usr/local/etc/rc.d/ejabberd status
 #v-
 
 Two instances of epmd were running, system one (the one running under root
 user) has bound itself to *:4369, whereas the ejabberd one has bound itself=
  to
 127.0.0.1.
 
 Sometimes above steps succeed (ejabberd is running), and sometimes not
 (ejabberd is not running), whereas when I stopped all epmd, and then started
 ejabberd only, i.e.:
 
 #v+
 % sudo pkill epmd
 % sudo /usr/local/etc/rc.d/ejabberd start
 % sudo /usr/local/etc/rc.d/ejabberd status
 #v-
 
 Then it succeeded. And now only one epmd was running, which was spawned by
 ejabberd.
 
 So from what I observed is that because two processes are listening on same
 port with overlapping addresses, it adds a level of non-determinism on which
 process is going to handle connection for 127.0.0.1:4369. Probably if we can
 instruct ejabberd to not start another epmd if one is already running, then
 may be we can achieve some level of determinism with this thing.
 
 It might be possible that epmd shipped with erlang 16b has some fixes which
 makes things slightly more reliable.
 
 >  There are two problems I noticed at shutdown:
 =20
 >  1) ejabberd spawns epmd if it is not already running but it does not kil=
 l it=20
 >  at shutdown.
 =20
 >  This can be fixed by using erlang's epmd script (add epmd_enable=3D"YES"=
  to a=20
 >  preferred rc.conf file). To ensure correct startup and shutdown ordering=
  it is=20
 >  necessary to change ejabberd's # REQUIRE: line as follows:
 =20
 >  # REQUIRE: DAEMON epmd
 
 Right, but I'm not sure if it'll fix this:
 
 #v+
 root      90075   0.0  0.0  14228   1620 ??  S     1:06PM      0:00.00 /usr=
 /local/bin/epmd -daemon
 ejabberd  90115   0.0  0.0  14228   1632 ??  S     1:06PM      0:00.00 /usr=
 /local/lib/erlang/erts-5.10.1/bin/epmd -daemon
 #v-
 
 =20
 >  2) epmd will not respond to the -kill option in its shutdown command unt=
 il all=20
 >  registered Names are removed (the -relaxed_command_check option is not u=
 sed=20
 >  when epmd is started).
 =20
 >  This is compounded because, once ejabberd has been signalled to stop by=
 =20
 >  ejabberdctl, the epmd script shutdown command can be executed before eja=
 bberd=20
 >  has unregistered its Name with epmd. This causes epmd to fail shutdown.
 =20
 >  A solution is to query epmd for ejabberd's Name, during shutdown, repeat=
 edly=20
 >  for up to 10 seconds (on my 1.6GHz server it takes about 6 seconds) wait=
 ing=20
 >  for ejabberd to unregister itself, after which epmd will shutdown cleanl=
 y.
 =20
 >  So, in summary:
 >  1) Add epmd_enable=3D"YES" to a preferred rc.conf file
 >  2) Add ejabberd_epmd_address=3D"a.real.ip.address" to a preferred rc.con=
 f file
 >  3) The ejabberd control script requires changes as per this after-instal=
 l=20
 >  patch:
 >  --- /usr/local/etc/rc.d/ejabberd.orig   2013-03-28 10:19:25.000000000 +0=
 000
 >  +++ /usr/local/etc/rc.d/ejabberd        2013-03-28 10:20:36.000000000 +0=
 000
 >  @@ -2,7 +2,7 @@
 >   # $FreeBSD: ports/net-im/ejabberd/files/ejabberd.in,v 1.10 2012/11/17 0=
 6:00:26=20
 >  svnexp Exp $
 =20=20
 >   # PROVIDE: ejabberd
 >  -# REQUIRE: DAEMON
 >  +# REQUIRE: DAEMON epmd
 >   # BEFORE: LOGIN
 >   # KEYWORD: shutdown
 =20=20
 >  @@ -58,8 +58,12 @@
 >   {
 >       echo "Stopping $name."
 >       if su $EJABBERDUSER -c "env ERL_EPMD_ADDRESS=3D\"${ejabberd_epmd_ad=
 dress}\"=20
 >  $EJABBERDCTL --node $ejabberd_node stop"; then
 >  -#        sleep 2
 >  -#        killall -u ejabberd -kill
 >  +        SECS=3D0
 >  +        while /usr/local/bin/epmd -names |grep 'ejabberd' >/dev/null; do
 >  +                sleep 1
 >  +                SECS=3D$(expr $SECS + 1)
 >  +                [ $SECS -eq 10 ] && exit
 >  +        done
 >       else
 >           _run_rc_notrunning
 >       fi
 
 The patch seems good, though I've not tried yet. I'll try it and provide a
 feedback probably next week, though it can't be committed until ports freeze
 is over.
 
 References:
 [1]  https://svn.redports.org/olgeni/lang/erlang/
 
 Thanks
 =2D-=20
 Ashish SHUKLA      | GPG: F682 CDCC 39DC 0FEA E116  20B6 C746 CFA9 E74F A4B0
 Sent from my Emacs
 
 --=-=-=
 Content-Type: application/pgp-signature
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (FreeBSD)
 
 iQIcBAEBCgAGBQJRVZdXAAoJEMdGz6nnT6Sw6joP+gJZa89RyWUdktoYoizrq8hD
 Dc0RmFx+XydQk1hWzCILoX0vCurcIye+X2pz6Nb3HnrYzH4WUh/uCCpf+dBmV6rw
 IN9SQfPK0z2G+iPWWvRRpqyRsSEWyhnZGnnQ5FXw10udi+ybTKjd3zuviH3+9LDw
 ukTzR0szpe6vYLtxEqTJTryv3Ah/KjBCQDhUu/YtyhqRJ2zy7YqXXHVh6OjSi7hu
 aeAqfFNAf/rwy/ADOAqtl/fh+hV4Mz9CJaX7QUBjprhOfC0mIWsuE8o2ZoXaKFXZ
 dnYOJySzMzdWTylstCNxlZPO1LSi3yoUSRu/lpeZDIHho/gl4juyxtWNNLz/3IwS
 91IIT4UuNQBuMgOJ+tf8m60SgmQSVeUoGM4Mrh7AkVXfn0kAtd1ewetuxH1f5scy
 R9i0aCQHfNXvNcm+GA+aR5ZZY82cFK65jZUUrl/4aYHnzyIKaydt72P7Sgmqj+d8
 Zs4ePsEvNkNn0h4tgOxYdNrZOQr1Pc9czGilCfFjhnsRmbSijXD3xU3jatewWzJg
 gWa+Wzwc+lRdAUaAJcN059zp3dFsGL2eM95vSKx0J2doW7j0zKbuDYK1Nn3feDUi
 Gps0mo/LGHqk7ALNk6UslJlIWEZ10uERqbSlxVBl+ETI62rQCtxhHmUWnVqZSJ7O
 It0mlYno4AdO2qSXyE6H
 =EDcV
 -----END PGP SIGNATURE-----
 --=-=-=--

From: Neil Darlow <neil@darlow.co.uk>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: ports/165360: net-im/ejabberd: ejabberdctl fails to communicate with ejabberd process
Date: Sat, 30 Mar 2013 08:36:08 +0000

 --nextPart1581695.lbtD7JvImA
 Content-Transfer-Encoding: 7Bit
 Content-Type: text/plain; charset="utf-8"
 
 On Friday 29 March 2013 18:59:56 Ashish SHUKLA wrote:
 > First of all, thank you for your time in investigating this.
 
 You are welcome. I am aware that maintainers may not be able to reproduce 
 specific problems experienced by users so it is only right that I should assist 
 wherever possible.
 
 > I'm not sure if that's the real reason. From what I noticed in my testing
 > few minutes ago with ejabberd 2.1.11, and erlang 16.b[1], that if I run
 > system epmd (i.e. $PREFIX/rc.d/epmd), it's able to register its name
 > intermittently, i.e.
 > 
 > #v+
 > % sudo /usr/local/etc/rc.d/epmd start
 > % sudo /usr/local/etc/rc.d/ejabberd start
 > % sudo /usr/local/etc/rc.d/ejabberd status
 > #v-
 > 
 > Two instances of epmd were running, system one (the one running under root
 > user) has bound itself to *:4369, whereas the ejabberd one has bound itself
 > to 127.0.0.1.
 
 I found this also, until I changed "ejabberd_epmd_address" to the physical IP 
 address of my network interface (which is also what my hostname resolves to - 
 coincidence?).
 
 > So from what I observed is that because two processes are listening on same
 > port with overlapping addresses, it adds a level of non-determinism on which
 > process is going to handle connection for 127.0.0.1:4369. Probably if we
 > can instruct ejabberd to not start another epmd if one is already running,
 > then may be we can achieve some level of determinism with this thing.
 
 Do you have faster hardware than my 1.6GHz system? Is it possible that epmd 
 has not started before ejabberd starts and it does not see it as running? That 
 might explain why you see two instances of epmd.
 
 I must admit, in the heavy testing I performed, this situation was not 
 arising. I did repeated "epmd start; ejabberd start", "ejabberd stop; epmd 
 stop" and reboot sequences.
 
 They all resulted in the following:
   786 ??  S       0:01.54 /usr/local/bin/epmd -daemon
   788 ??  S       0:32.13 /usr/local/sbin/winbindd -s /usr/local/etc/smb.conf
   789 ??  S       0:00.62 /usr/local/sbin/smbd -D -s /usr/local/etc/smb.conf
   803 ??  I       0:24.54 /usr/local/lib/erlang/erts-5.9.3.1/bin/beam.smp -P 
 250000 -- -root /usr/local/lib/erlang -progname erl -- -home 
 /var/spool/ejabberd -- -sname ejabberd@bumblebee -noshell -noinput -noshell -
 noinput -pa /usr/local/lib/erlang/lib/ejabberd-2.1.11/ebin -mnesia dir 
 "/var/spool/ejabberd" -kernel inet_dist_use_interface {192,168,1,2} -s 
 ejabberd -sasl sasl_error_logger {file,"/var/log/ejabberd/erlang.log"} -smp 
 auto start start
   807 ??  Is      0:00.02 inet_gethost 4
   808 ??  I       0:00.08 inet_gethost 4
 
 This is from a boot invokation. Manual startup results in beam.smp immediately 
 following epmd in the process listing, as you would expect.
 
 > Right, but I'm not sure if it'll fix this:
 > 
 > #v+
 > root      90075   0.0  0.0  14228   1620 ??  S     1:06PM      0:00.00
 > /usr/local/bin/epmd -daemon ejabberd  90115   0.0  0.0  14228   1632 ??  S 
 >    1:06PM      0:00.00 /usr/local/lib/erlang/erts-5.10.1/bin/epmd -daemon
 > #v-
 
 I have not seen two instances of epmd running since I set 
 ejabberd_epmd_address from its default value of 127.0.0.1. If you have done 
 that then there must be another cause like I mentioned earlier.
 
 > The patch seems good, though I've not tried yet. I'll try it and provide a
 > feedback probably next week, though it can't be committed until ports freeze
 > is over.
 
 Well, we still need to resolve the issue you experience that I currently do 
 not before that commit also.
 
 Regards,
 Neil Darlow
 --nextPart1581695.lbtD7JvImA
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: This is a digitally signed message part.
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iEYEABECAAYFAlFWpAMACgkQ5XniSlMfkEhndQCeMwMGLY0L0449ACdP18LVoGKh
 6r0An2BgKZpSAEsKDMK4TvkKoh2aotoh
 =4rdX
 -----END PGP SIGNATURE-----
 
 --nextPart1581695.lbtD7JvImA--
 
>Unformatted:
