Skip to content

Commit 3d92284

Browse files
Start TCP and TLS listeners later in boot process
See #1869 for background. This makes listener startup and peer notification to be some of the last boot steps. This way client operations on a node that's not 100% initialised are less likely. Since some parts of boot process happen concurrently, without coordinating all of them with listener startup this is not something that can be guaranteed. Moving listener startup to a later stage reduces the probability of clients attempting operations on a booting node.
1 parent cb90500 commit 3d92284

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

src/rabbit.erl

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
-rabbit_boot_step({recovery,
187187
[{description, "exchange, queue and binding recovery"},
188188
{mfa, {rabbit, recover, []}},
189-
{requires, [core_initialized]},
189+
{requires, upgrade_queues},
190190
{enables, routing_ready}]}).
191191

192192
-rabbit_boot_step({empty_db_check,
@@ -197,43 +197,52 @@
197197

198198
-rabbit_boot_step({routing_ready,
199199
[{description, "message delivery logic ready"},
200-
{requires, core_initialized}]}).
200+
{requires, [core_initialized, recovery]}]}).
201201

202202
-rabbit_boot_step({direct_client,
203203
[{description, "direct client"},
204204
{mfa, {rabbit_direct, boot, []}},
205-
{requires, routing_ready}]}).
205+
{requires, routing_ready}
206+
]}).
206207

207208
-rabbit_boot_step({connection_tracking,
208-
[{description, "sets up internal storage for node-local connections"},
209+
[{description, "connection tracking infrastructure"},
209210
{mfa, {rabbit_connection_tracking, boot, []}},
210-
{requires, routing_ready}]}).
211-
212-
-rabbit_boot_step({networking,
213-
[{mfa, {rabbit_networking, boot, []}},
214-
{requires, routing_ready}]}).
215-
216-
-rabbit_boot_step({notify_cluster,
217-
[{description, "notify cluster nodes"},
218-
{mfa, {rabbit_node_monitor, notify_node_up, []}},
219-
{requires, networking}]}).
211+
{enables, routing_ready}]}).
220212

221213
-rabbit_boot_step({background_gc,
222214
[{description, "background garbage collection"},
223215
{mfa, {rabbit_sup, start_restartable_child,
224216
[background_gc]}},
225-
{enables, networking}]}).
217+
{requires, [core_initialized, recovery]},
218+
{enables, routing_ready}]}).
226219

227220
-rabbit_boot_step({rabbit_core_metrics_gc,
228221
[{description, "background core metrics garbage collection"},
229222
{mfa, {rabbit_sup, start_restartable_child,
230223
[rabbit_core_metrics_gc]}},
231-
{enables, networking}]}).
224+
{requires, [core_initialized, recovery]},
225+
{enables, routing_ready}]}).
232226

233227
-rabbit_boot_step({rabbit_looking_glass,
234228
[{description, "Looking Glass tracer and profiler"},
235229
{mfa, {rabbit_looking_glass, boot, []}},
236-
{requires, networking}]}).
230+
{requires, [core_initialized, recovery]},
231+
{enables, routing_ready}]}).
232+
233+
-rabbit_boot_step({pre_flight,
234+
[{description, "ready to communicate with peers and clients"},
235+
{requires, [core_initialized, recovery, routing_ready]}]}).
236+
237+
-rabbit_boot_step({notify_cluster,
238+
[{description, "notifies cluster peers of our presence"},
239+
{mfa, {rabbit_node_monitor, notify_node_up, []}},
240+
{requires, pre_flight}]}).
241+
242+
-rabbit_boot_step({networking,
243+
[{description, "TCP and TLS listeners"},
244+
{mfa, {rabbit_networking, boot, []}},
245+
{requires, notify_cluster}]}).
237246

238247
%%---------------------------------------------------------------------------
239248

0 commit comments

Comments
 (0)