Skip to content

Commit 87a8c15

Browse files
committed
rabbit: Stop rabbitmq_prelaunch if we fail to start rabbit
[Why] This is important if the environment changes between that error and the next attempt to start `rabbit': the environment is only read during the start of `rabbitmq_prelaunch' (and the cached context is cleaned on stop). This fixes a transient failure of the `unit_log_management_SUITE:log_file_fails_to_initialise_during_startup/1` testcase. V2: Explicitly ignore the return value of `application:stop/1`.
1 parent 3d10f25 commit 87a8c15

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

deps/rabbit/src/rabbit.erl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,16 @@ start_it(StartType) ->
433433
ok
434434
catch
435435
error:{badmatch, Error}:_ ->
436+
%% `rabbitmq_prelaunch' was started before `rabbit' above.
437+
%% If the latter fails to start, we must stop the former as
438+
%% well.
439+
%%
440+
%% This is important if the environment changes between
441+
%% that error and the next attempt to start `rabbit': the
442+
%% environment is only read during the start of
443+
%% `rabbitmq_prelaunch' (and the cached context is cleaned
444+
%% on stop).
445+
_ = application:stop(rabbitmq_prelaunch),
436446
stop_boot_marker(Marker),
437447
case StartType of
438448
temporary -> throw(Error);

0 commit comments

Comments
 (0)