25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-30 16:36:29 +01:00

Fix problem starting ejabberd when first host uses SQL, other one mnesia

The problem appeared when there are several vhosts,
the first vhost uses SQL for persistent data (and RAM for volatile),
and another vhost wants to use Mnesia

Example config to trigger the problem:

  hosts:
    - mysql.localhost
    - localhost
  host_config:
    mysql.localhost:
      default_db: sql

In that case, ejabberd crashed at start with an error like:
[critical] Internal error of module mod_muc has occurred during start:
...
** exception exit: {aborted,
                     {no_exists,
                         [muc_room,
                          [{{muc_room,{'_',<<"conference.localhost">>},'_'},
                            [],
                            ['$_']}]]}}
This commit is contained in:
Badlop 2024-11-22 19:13:46 +01:00
parent 22e7ce37d4
commit c291c20a3b

View File

@ -57,6 +57,10 @@ init(Host, Opts) ->
transient, 5000, worker, [?MODULE]}, transient, 5000, worker, [?MODULE]},
case supervisor:start_child(ejabberd_backend_sup, Spec) of case supervisor:start_child(ejabberd_backend_sup, Spec) of
{ok, _Pid} -> ok; {ok, _Pid} -> ok;
%% Maybe started for a vhost which only wanted mnesia for ram
%% and this vhost wants mnesia for persitent storage too
{error, {already_started, _Pid}} ->
init([Host, Opts]);
Err -> Err Err -> Err
end. end.