diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2020-01-24 12:17:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-24 12:17:01 +0100 |
| commit | f618e7e766bb20ce4e99d9a67751b512b10d64a5 (patch) | |
| tree | d4b9ea9e5e6f23d98a5588e0534b7d9bf9f98a6a /src/rabbit.erl | |
| parent | dd8262646d208e394844e26edbc1fec47949129d (diff) | |
| parent | ba1b6cbbfe24715d98eac5a6c97e199db137c76d (diff) | |
| download | rabbitmq-server-git-f618e7e766bb20ce4e99d9a67751b512b10d64a5.tar.gz | |
Merge pull request #2220 from rabbitmq/fix-bootsteps-run-vs-app-start-order
rabbit: Fix plugins' run_boot_steps() vs. start order
Diffstat (limited to 'src/rabbit.erl')
| -rw-r--r-- | src/rabbit.erl | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl index 7f16d0b1d1..292272738d 100644 --- a/src/rabbit.erl +++ b/src/rabbit.erl @@ -983,18 +983,28 @@ do_run_postlaunch_phase() -> rabbit_log_prelaunch:debug("== Plugins =="), rabbit_log_prelaunch:debug("Setting plugins up"), + %% `Plugins` contains all the enabled plugins, plus their + %% dependencies. The order is important: dependencies appear + %% before plugin which depend on them. Plugins = rabbit_plugins:setup(), rabbit_log_prelaunch:debug( "Starting the following plugins: ~p", [Plugins]), + %% We can load all plugins and refresh their feature flags at + %% once, because it does not involve running code from the + %% plugins. app_utils:load_applications(Plugins), ok = rabbit_feature_flags:refresh_feature_flags_after_app_load( Plugins), + %% However, we want to run their boot steps and actually start + %% them one by one, to ensure a dependency is fully started + %% before a plugin which depends on it gets a chance to start. lists:foreach( fun(Plugin) -> - case application:ensure_all_started(Plugin) of - {ok, _} -> rabbit_boot_steps:run_boot_steps([Plugin]); - Error -> throw(Error) - end + ok = rabbit_boot_steps:run_boot_steps([Plugin]), + case application:ensure_all_started(Plugin) of + {ok, _} -> ok; + Error -> throw(Error) + end end, Plugins), rabbit_log_prelaunch:debug("Marking RabbitMQ as running"), |
