processone / ejabberd-contrib

Growing and curated ejabberd contributions repository - PR or ask to join !
http://ejabberd.im
250 stars 140 forks source link

Ejabberd auth http seems to be stuck while adding the cuesport workers to the supervision tree #219

Closed satish-olx closed 7 years ago

satish-olx commented 7 years ago

Hi, My nodes did not show any error in starting although they did not properly start, as shown by the ejabberdctl status . I debugged through the code of ejabberd_auth_http and

    {ok, _} = supervisor:start_child(ejabberd_sup,
                                     {{ejabberd_auth_http_sup, Host},
                                      {cuesport, start_link,
                                       [pool_name(Host), PoolSize, ChildMods, ChildMFA]},
                                      transient, 2000, supervisor, [cuesport | ChildMods]})

seems to be the cause of this. Specifically I entered into a live node with the help of debug and ran this exact command which seems to hang the shell.

I am using the v 17.07.

zinid commented 7 years ago

From the documentation:

WARNING: only "core stuff" should be attached to ejabberd_sup. For attaching modules use gen_mod's supervisor (via gen_mod:start_child/3,4 functions), for attaching database backend modules use ejabberd_backend_sup supervisor, etc.

So it's incorrectly to attach ejabberd_auth_http_sup to ejabberd_sup. The correct solution is to re-write the code as a module and attach anything to the gen_mod supervisor (this is done automatcially actually by calling to gen_mod:start_child/3,4).

satish-olx commented 7 years ago

@zinid Thanks for the guidelines. Although why it hanged remains a mystery to me, can you shed some light on that ?

zinid commented 7 years ago

There were some rework recently on ejabberd supervisors, somehow ejabberd_auth_http was affected.

papandopalas commented 7 years ago

@satish-olx Hi, did you fix this module? It seems I have a similar issue.

satish-olx commented 7 years ago

As per design changes, instead of ejabberd_sup you have to use ejabberd_gen_mod_sup as the supervisor for modules. As to why it blocks, I could not find the cause @papandopalas. Do notify me if you discover that.