Repository navigation
Commit 2ef1651
authored
core/amqp_leader: fix cluster cron never starting (#72)
* core: fix cluster cron never starting
amqp_cron has never started a task on any node. Two defects, the second
masked by the first.
1. amqp_leader declared no dependency on kazoo_globals, despite
amqp_leader_listener gating readiness on kz_nodes:is_up/1. The release
boot script therefore started amqp_leader and amqp_cron *before*
kazoo_globals, so the kz_nodes ETS table did not exist yet and
ets:match/2 raised badarg instead of returning []. The retry loop in
ready_when_node_is_up/0 only handles is_up -> false, so the badarg
escaped, burned amqp_leader_proc_sup's restart budget in ~5ms and left
it dead: transient children are not restarted after a 'shutdown' exit.
Declaring the dependency fixes the boot order (kazoo_globals 32 ->
amqp_leader 33 -> amqp_cron 34). No cycle: nothing kazoo_globals
depends on reaches amqp_leader.
2. With the gate cleared, amqp_cron reached its first AMQP message and
died on "undefined function amqp_cron:handle_info/3".
amqp_leader_proc:exec_callback/2 appends [ModState, Leader] to every
callback's arguments. amqp_cron honours that for handle_cast/3,
handle_call/4, handle_DOWN/3 and from_leader/3, but exported
handle_info/2.
Also make kz_nodes:is_up/1 total: it now answers false when the registry
is not running rather than raising, which is what its one caller has
always wanted. The unused expires = '$2' binding is dropped -- it was
matched and discarded, implying a recency check that is not performed.
Verified on a dev node: amqp_cron:status/0 now reports an elected leader,
the pid is stable across minutes, and the boot log contains no ets:match
badarg, no reached_max_restart_intensity and no handle_info crash.
* CONTEXT: name the cluster-membership layer
The glossary had no vocabulary for the layer this bug lives in: no term
for the node registry, for leader election, or for cluster-wide scheduled
work. That gap is plausibly why amqp_leader's dependency on kazoo_globals
went undeclared for so long -- the relationship had no name.
Adds Node, Node registry, Leader and Cluster cron. The Node registry
entry records the semantics kz_nodes actually implements: membership is
liveness, pruned by the expiry sweep, with no separate recency check.1 parent 3dfb75b commit 2ef1651
4 files changed
Lines changed: 40 additions & 11 deletions
File tree
- core
- amqp_cron/src
- amqp_leader/src
- kazoo_globals/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
124 | 145 | | |
125 | 146 | | |
126 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
304 | | - | |
305 | | - | |
| 304 | + | |
| 305 | + | |
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
128 | 137 | | |
129 | 138 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
138 | 143 | | |
139 | 144 | | |
140 | 145 | | |
| |||
0 commit comments