How clustering ejabberd with "FIREWALL_WINDOW" option

Hello,

I installed the ejabberd 2.1.4 on CentOS 5.4 from Source Code.
The ejabberd completely works on a single server.

Next, I want to work ejabberd with clustering on two servers,
but my servers ports are secured from iptables.

I don't want to open several ports,
so now I have worked another program using erlang clustering with below option.

---
erl -kernel inet_dist_listen_min 50000 inet_dist_listen_max 50000
---

"50000" is setting as exapmle port.
I can work erlang clustering program with this "kernel" option.

I hope to try the ejabberd as well,
write config file "INSTALL_DIR/etc/ejabberd/ejabberdctl.cfg" below.

---
FIREWALL_WINDOW=50000-50000
---

"FIREWALL_WINDOW" option can use from ejabberd 2.0.0 from Release Notes,
but if "FIREWALL_WINDOW" change active, error is happend and ejabberd didn't work.

Next error messages are displaied by "INSTALL_DIR/sbin/ejabberdctl live" command.

---
{error_logger,{{2010,6,23},{15,12,57}},"application_controller: ~s: ~s~n",[["syntax error before: ","'.'"],[]]}
{error_logger,{{2010,6,23},{15,12,57}},"~s~n",["Error in process <0.6.0> with exit value: {{case_clause,{error,{bad_environment_value,[]}}},[{application_controller,init,2}]}\n"]}
{"could not start kernel pid",application_controller,"{{case_clause,{error,{bad_environment_value,[]}}},[{application_controller,init,2}]}"}

Crash dump was written to: /usr/local/ejabberd-2.1.3/var/log/ejabberd/erl_crash_20100623-151256.dump
could not start kernel pid (application_controller) ({{case_clause,{error,{bad_environment_value,[]}}},[{application_controller,init,2}]})
---

I tried variously, but I don't understand how "FIREWALL_WINDOW" use.
Thanks kindly.

Problem in ejabberdctl. Try patch

Hachi wrote:

if "FIREWALL_WINDOW" change active, error is happend and ejabberd didn't work.
Next error messages are displaied by "INSTALL_DIR/sbin/ejabberdctl live" command.

---
{error_logger,{{2010,6,23},{15,12,57}},"application_controller: ~s: ~s~n",[["syntax error before: ","'.'"],[]]}
{error_logger,{{2010,6,23},{15,12,57}},"~s~n",["Error in process <0.6.0> with exit value: {{case_clause,{error,{bad_environment_value,[]}}},[{application_controller,init,2}]}\n"]}
{"could not start kernel pid",application_controller,"{{case_clause,{error,{bad_environment_value,[]}}},[{application_controller,init,2}]}"}

Crash dump was written to: /usr/local/ejabberd-2.1.3/var/log/ejabberd/erl_crash_20100623-151256.dump
could not start kernel pid (application_controller) ({{case_clause,{error,{bad_environment_value,[]}}},[{application_controller,init,2}]})
---

You found a bug in ejabberd. I hope this patch solves it:

--- a/src/ejabberdctl.template
+++ b/src/ejabberdctl.template
@@ -82,7 +82,7 @@ else
     KERNEL_OPTS="-kernel inet_dist_listen_min ${FIREWALL_WINDOW%-*} inet_dist_listen_max ${FIREWALL_WINDOW#*-}"
 fi

-ERLANG_OPTS="+K $POLL -smp $SMP +P $ERL_PROCESSES $ERL_OPTIONS $KERNEL_OPTS"
+ERLANG_OPTS="+K $POLL -smp $SMP +P $ERL_PROCESSES $ERL_OPTIONS"

 # define additional environment variables
 if [ "$EJABBERDDIR" = "" ]; then
@@ -141,6 +141,7 @@ start ()
       -noinput -detached \
       -pa $EJABBERD_EBIN_PATH \
       -mnesia dir \"\\\"$SPOOLDIR\\\"\" \
+      $KERNEL_OPTS \
       -s ejabberd \
       -sasl sasl_error_logger \\{file,\\\"$SASL_LOG_PATH\\\"\\} \
       $ERLANG_OPTS $ARGS \"$@\""
@@ -174,6 +175,7 @@ debug ()
       $NAME debug-${TTY}-${ERLANG_NODE} \
       -remsh $ERLANG_NODE \
       -hidden \
+      $KERNEL_OPTS \
       $ERLANG_OPTS $ARGS \"$@\""
 }

@@ -203,6 +205,7 @@ live ()
       $NAME $ERLANG_NODE \
       -pa $EJABBERD_EBIN_PATH \
       -mnesia dir \"\\\"$SPOOLDIR\\\"\" \
+      $KERNEL_OPTS \
       -s ejabberd \
       $ERLANG_OPTS $ARGS \"$@\""
 }
@@ -310,6 +313,7 @@ ctlexec ()
       -noinput \
       -hidden \
       -pa $EJABBERD_EBIN_PATH \
+      $KERNEL_OPTS \
       -s ejabberd_ctl -extra $ERLANG_NODE $COMMAND"
 }

Please comment if that patch solves the problem for you.

Hachi wrote:

I don't want to open several ports,
FIREWALL_WINDOW=50000-50000
"FIREWALL_WINDOW" option can use from ejabberd 2.0.0 from Release Notes,

Better allow at least 2 ports, like 50000-50001.

It works with your patch!

badlop wrote:

You found a bug in ejabberd. I hope this patch solves it:
Please comment if that patch solves the problem for you.

Better allow at least 2 ports, like 50000-50001.

Thank you very much for your answer!

I tried that patch with "FIREWALL_OPTION=50000-500001" option.

I obtained the result that ejabberd server works on target ports!
It confirmed by both "net_adm:names()" command on ejabberd live mode,
and "netstat" command on linux.

Thanks for badlop!

Patch committed

Hachi wrote:

I tried that patch with "FIREWALL_OPTION=50000-500001" option.

I obtained the result that ejabberd server works on target ports!
It confirmed by both "net_adm:names()" command on ejabberd live mode,
and "netstat" command on linux.

Ok, I've committed the patch to ejabberd git.

Syndicate content