[ejabberd] Clustered deployments

Carlos Abalde carlos.abalde at gmail.com
Wed Jul 29 14:46:10 MSD 2009


> Anyway, after doing a few experiments which dedicated frontend and
> backend nodes I've discovered some implementation issues. It seems
> possible to do some quick workarounds to enable the component
> separation, but the point is that it seems to be undocumented just
> because it's unfinished. I don't know...

Ok, there is a workaround to enable frontend/backend separation. Current
ejabberd implementation (2.0.5) generates a deadlock with
ejabberd_frontend_socket when an ejabberd_c2s process (int its
initialization function) tries to get the the peer IP calling peername/1
in ejabberd_frontend_socket process (since ejabberd_c2s process is
created by ejabberd_frontend_socket in its initialization function).

A simple hack to avoid the deadlock is getting the peer IP in the
ejabberd_frontend_socket after creating the C2S process:

  IP = case (case SockMod of
		 gen_tcp -> inet:peername(Socket);
		 _       -> SockMod:peername(Socket)
	     end) of
	   {ok, AnIP} -> AnIP;
	   _          -> undefined
       end,
  supervisor:start_child(ejabberd_frontend_socket_sup,
			 [Module, SockMod, Socket, [{ip_hack, IP}| Opts], Receiver]);


And the use the received IP in the ejabber_c2s module (instead of trying
to get it asking to the socket process):

  IP = case lists:keysearch(ip_hack, 1, Opts) of
	   {value, {_, AnIP}} -> AnIP;
	   _                  -> peerip(SockMod, Socket)
       end,

It's a little bit ugly hack, but it could be useful for other people
wanting to try the component separation stuff.

--
Carlos.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20090729/31228196/attachment.pgp>


More information about the ejabberd mailing list