Skip to content

Commit 5bf280a

Browse files
dumbbellmergify[bot]
authored andcommitted
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`. (cherry picked from commit 87a8c15)
1 parent deca198 commit 5bf280a

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
@@ -428,6 +428,16 @@ start_it(StartType) ->
428428
ok
429429
catch
430430
error:{badmatch, Error}:_ ->
431+
%% `rabbitmq_prelaunch' was started before `rabbit' above.
432+
%% If the latter fails to start, we must stop the former as
433+
%% well.
434+
%%
435+
%% This is important if the environment changes between
436+
%% that error and the next attempt to start `rabbit': the
437+
%% environment is only read during the start of
438+
%% `rabbitmq_prelaunch' (and the cached context is cleaned
439+
%% on stop).
440+
_ = application:stop(rabbitmq_prelaunch),
431441
stop_boot_marker(Marker),
432442
case StartType of
433443
temporary -> throw(Error);

0 commit comments

Comments
 (0)