{error,already_present}

If a module has crashed, and you try to start it again from the Erlang shell with:

mod_foo:start("example.com", []).

and you get the result:

{error, already_present}

the module is trying to register its child specification with the process supervisor, but it has already been registered, and it didn't succeed in unregistering it when it crashed. This could actually make things simpler; you could ask the supervisor to restart the module for you:

supervisor:restart_child(ejabberd_sup, gen_mod:get_module_proc("example.com", ejabberd_mod_foo)).

On the other hand, you can delete the child specification:

supervisor:delete_child(ejabberd_sup, gen_mod:get_module_proc("example.com", ejabberd_mod_foo)).

and then restart the module however you want.

Syndicate content