Search code examples
ejabberd

Ejabberd does not work on MAC with [Failed to open socket at [::]:5222]


I am facing errors at the first cup of Ejabberd. On my Mac(10.13.6) I installed "ejabberd-18.12.1-osx.app" and I have followed all instruction written in official website. (https://docs.ejabberd.im/admin/installation/#install-on-macos)

After installation was completed I noticed nothing significant and found error logs were generated as below.

2019-01-16 10:02:03.936 [error] <0.316.0>@ejabberd_listener:report_socket_error:417 Failed to open socket at [::]:5222 for ejabberd_c2s: address already in use 2019-01-16 10:02:03.937 [error] <0.315.0> Supervisor ejabberd_listener had child {5222,{0,0,0,0,0,0,0,0},tcp} started with ejabberd_listener:start({5222,{0,0,0,0,0,0,0,0},tcp}, ejabberd_c2s, [{ip,{0,0,0,0,0,0,0,0}},{max_stanza_size,262144},{shaper,c2s_shaper},{access,c2s},{starttls_required,...}]) at undefined exit with reason eaddrinuse in context start_error 2019-01-16 10:02:03.937 [error] <0.274.0> Supervisor ejabberd_sup had child ejabberd_listener started with ejabberd_listener:start_link() at undefined exit with reason {shutdown,{failed_to_start_child,{5222,{0,0,0,0,0,0,0,0},tcp},eaddrinuse}} in context start_error 2019-01-16 10:02:03.942 [critical] <0.81.0>@ejabberd_app:start:66 Failed to start ejabberd application: {error,{shutdown,{failed_to_start_child,ejabberd_listener,{shutdown,{failed_to_start_child,{5222,{0,0,0,0,0,0,0,0},tcp},eaddrinuse}}}}}

I exactly understand what "address already in use" means but netstat does not show any possession on this port. Also I never changed any of the server configuration. I tried to start server manually but same errors repeats.

Does this version of Ejabberd have bugs on Mac installation?

Many thanks in advance.


Solution

  • When ejabberd starts, it uses several ports (some for XMPP, others for additional ejabberd features, others for Erlang). Notice that some ports may be in IPv6:

    tcp        0      0 0.0.0.0:42859           0.0.0.0:*               LISTEN     
    tcp        0      0 0.0.0.0:4560            0.0.0.0:*               LISTEN     
    tcp        0      0 0.0.0.0:epmd            0.0.0.0:*               LISTEN     
    tcp        0      0 0.0.0.0:5280            0.0.0.0:*               LISTEN     
    tcp6       0      0 [::]:epmd               [::]:*                  LISTEN     
    tcp6       0      0 [::]:xmpp-client        [::]:*                  LISTEN     
    tcp6       0      0 [::]:xmpp-server        [::]:*                  LISTEN    
    

    Maybe you have other previous ejabberd installation around there messing? Or other XMPP server?