Skip to content

Commit 3ab71e2

Browse files
Merge pull request #1913 from rabbitmq/rabbitmq-server-1869
Move TCP and TLS listener startup to the last boot step "stage" (cherry picked from commit 9bc3386)
1 parent 4e062c0 commit 3ab71e2

File tree

3 files changed

+42
-27
lines changed

3 files changed

+42
-27
lines changed

src/rabbit.erl

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -189,43 +189,52 @@
189189

190190
-rabbit_boot_step({routing_ready,
191191
[{description, "message delivery logic ready"},
192-
{requires, core_initialized}]}).
193-
194-
-rabbit_boot_step({direct_client,
195-
[{description, "direct client"},
196-
{mfa, {rabbit_direct, boot, []}},
197-
{requires, routing_ready}]}).
192+
{requires, [core_initialized, recovery]}]}).
198193

199194
-rabbit_boot_step({connection_tracking,
200-
[{description, "sets up internal storage for node-local connections"},
195+
[{description, "connection tracking infrastructure"},
201196
{mfa, {rabbit_connection_tracking, boot, []}},
202-
{requires, routing_ready}]}).
203-
204-
-rabbit_boot_step({networking,
205-
[{mfa, {rabbit_networking, boot, []}},
206-
{requires, routing_ready}]}).
207-
208-
-rabbit_boot_step({notify_cluster,
209-
[{description, "notify cluster nodes"},
210-
{mfa, {rabbit_node_monitor, notify_node_up, []}},
211-
{requires, networking}]}).
197+
{enables, routing_ready}]}).
212198

213199
-rabbit_boot_step({background_gc,
214200
[{description, "background garbage collection"},
215201
{mfa, {rabbit_sup, start_restartable_child,
216202
[background_gc]}},
217-
{enables, networking}]}).
203+
{requires, [core_initialized, recovery]},
204+
{enables, routing_ready}]}).
218205

219206
-rabbit_boot_step({rabbit_core_metrics_gc,
220207
[{description, "background core metrics garbage collection"},
221208
{mfa, {rabbit_sup, start_restartable_child,
222209
[rabbit_core_metrics_gc]}},
223-
{enables, networking}]}).
210+
{requires, [core_initialized, recovery]},
211+
{enables, routing_ready}]}).
224212

225213
-rabbit_boot_step({rabbit_looking_glass,
226214
[{description, "Looking Glass tracer and profiler"},
227215
{mfa, {rabbit_looking_glass, boot, []}},
228-
{requires, networking}]}).
216+
{requires, [core_initialized, recovery]},
217+
{enables, routing_ready}]}).
218+
219+
-rabbit_boot_step({pre_flight,
220+
[{description, "ready to communicate with peers and clients"},
221+
{requires, [core_initialized, recovery, routing_ready]}]}).
222+
223+
-rabbit_boot_step({direct_client,
224+
[{description, "direct client"},
225+
{mfa, {rabbit_direct, boot, []}},
226+
{requires, pre_flight}
227+
]}).
228+
229+
-rabbit_boot_step({notify_cluster,
230+
[{description, "notifies cluster peers of our presence"},
231+
{mfa, {rabbit_node_monitor, notify_node_up, []}},
232+
{requires, pre_flight}]}).
233+
234+
-rabbit_boot_step({networking,
235+
[{description, "TCP and TLS listeners"},
236+
{mfa, {rabbit_networking, boot, []}},
237+
{requires, notify_cluster}]}).
229238

230239
%%---------------------------------------------------------------------------
231240

src/rabbit_boot_steps.erl

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ run_boot_steps() ->
2323
run_boot_steps(loaded_applications()).
2424

2525
run_boot_steps(Apps) ->
26-
[ok = run_step(Attrs, mfa) || {_, _, Attrs} <- find_steps(Apps)],
26+
[begin
27+
rabbit_log:info("Running boot step ~s defined by app ~s", [Step, App]),
28+
ok = run_step(Attrs, mfa)
29+
end || {App, Step, Attrs} <- find_steps(Apps)],
2730
ok.
2831

2932
run_cleanup_steps(Apps) ->
@@ -46,10 +49,14 @@ run_step(Attributes, AttributeName) ->
4649
[] ->
4750
ok;
4851
MFAs ->
49-
[case apply(M,F,A) of
50-
ok -> ok;
51-
{error, Reason} -> exit({error, Reason})
52-
end || {M,F,A} <- MFAs],
52+
[begin
53+
rabbit_log:debug("Applying MFA: M = ~s, F = ~s, A = ~p",
54+
[M, F, A]),
55+
case apply(M,F,A) of
56+
ok -> ok;
57+
{error, Reason} -> exit({error, Reason})
58+
end
59+
end || {M,F,A} <- MFAs],
5360
ok
5461
end.
5562

src/rabbit_vhost.erl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ recover() ->
6060
%% So recovery will be run every time a vhost supervisor is restarted.
6161
ok = rabbit_vhost_sup_sup:start(),
6262

63-
[ ok = rabbit_vhost_sup_sup:init_vhost(VHost)
64-
|| VHost <- rabbit_vhost:list()],
63+
[ok = rabbit_vhost_sup_sup:init_vhost(VHost) || VHost <- rabbit_vhost:list()],
6564
ok.
6665

6766
recover(VHost) ->

0 commit comments

Comments
 (0)