Repository navigation
Description
Found while validating the post-#5268/#5271/#5275 fixes on a fresh 26.8.1-SNAPSHOT (digest 8ee87c28…, all 3 nodes same build) — the membership/rejoin fixes work (the leader reconnected to the recreated pod immediately, live appender telemetry), but the recreated follower is stuck in an infinite 3-second crash-restart loop on a term-inverted entry in its persisted Raft log, and the new CLOSED-member auto-restart from #5271 keeps faithfully restarting it into the same crash.
Sequence
3-node StatefulSet, fresh parallel bootstrap earlier this morning (some transient failures during it, then all Ready). Then a single kubectl delete pod of arcadedb-0 (graceful — clean shutdown, no unclean-close recovery on restart). The recreated pod resumes its persisted Raft storage and loops:
08:57:42.477 INFO [ArcadeStateMachine] ArcadeStateMachine initialized (groupId=group-E6A6271798FD)
08:57:42.513 SEVER [StateMachineUpdater] ..._2434@group-...-StateMachineUpdater caught a Throwable.
java.lang.IllegalStateException: ..._2434: Failed updateLastAppliedTermIndex: newTI = (t:3, i:4946) < oldTI = (t:4, i:4945)
08:57:45.288 SEVER [RaftServer$Division] Failed appendEntries* (leader heartbeat #9338-t4, previous=(t:4, i:4948), leaderCommit=4948):
org.apache.ratis.protocol.exceptions.ServerNotReadyException: ... is not in [STARTING, RUNNING]: current state is CLOSED
08:57:45.522 INFO [ArcadeStateMachine] ArcadeStateMachine initialized (groupId=group-E6A6271798FD) <- #5271 auto-restart, ~3s cadence
08:57:45.558 SEVER [StateMachineUpdater] ... Failed updateLastAppliedTermIndex: newTI = (t:3, i:4946) < oldTI = (t:4, i:4945)
... (92 iterations and counting in the first ~8 minutes)
Observations
- The on-disk Raft state is self-inconsistent: applied index is
(t:4, i:4945)but the log entry ati:4946carries term 3 — term going backwards with increasing index. Presumably a conflicting suffix from a pre-term-4 leader that should have been truncated when the term-4 leader overwrote it, with the truncation (or the applied-index marker) not persisted consistently. The morning bootstrap went through several quick term changes; the pod delete that exposed this was graceful. - The HA/k8s: stranded follower's Raft server left CLOSED after failed auto-join — restarting the leader then causes a permanent full-cluster outage (quorum impossible) #5271 fix works but has no backoff/classification: the health monitor detects the CLOSED member and restarts it every ~3s, forever. After N identical crashes it should stop treating it as transient.
divergedFollowerRecoverydoes not catch it: the reformat-and-rejoin path (divergedFollowerMaxReformats=5) apparently only classifies WAL-version-gap errors as divergence. ThisIllegalStateExceptionfrom Ratis'supdateLastAppliedTermIndexis arguably the clearest possible divergence signal, and it's exactly the case where a reformat would help — but it just crash-loops instead.- Status masking: the leader's telemetry for the looping follower reads
replicaStatus: HEALTHY, replicationLag: 0— appends land in the brief STARTING→RUNNING window each cycle, so every status surface says healthy while the node crashes 20×/minute and readiness stays 503.
Suggested fixes
- Classify
Failed updateLastAppliedTermIndex(and StateMachineUpdater throwables generally) as follower divergence → route into the existing reformat-and-rejoin path instead of a bare member restart. - Give the HA/k8s: stranded follower's Raft server left CLOSED after failed auto-join — restarting the leader then causes a permanent full-cluster outage (quorum impossible) #5271 auto-restart a crash-loop detector: after K identical failures within a window, escalate (reformat, or stop and raise a visible alert) instead of restarting forever.
- Surface the crash loop: a member that failed >K restarts should not report HEALTHY/lag-0 to the leader's status API.
Recovery
Single-node reformat (wipe the node's raftStorageDirectory + force-recreate the pod) — will report back whether the new auto-join retry path re-adds it cleanly on this build.
Activity
ruispereira commentedon Jul 15, 2026
Major update — the corruption is in the group's replicated state, not the node's local storage. We did the single-node reformat exactly as planned (verified the wipe target against the process cmdline:
raftStorageDirectory=/home/arcadedb/databases/.raft-storage, no stray directory elsewhere; force-delete so nothing was re-persisted; the recreated pod's raft-storage dir is brand new, mtime = this boot).The freshly-wiped node crashes with the exact same inversion —
newTI = (t:3, i:4946) < oldTI = (t:4, i:4945)— 0.8s afterRaftHAServer configured, before anything else, and then loops (121 crashes so far this boot).For a node with zero local history to reach
oldTI=(t:4, i:4945)and then be handed(t:3, i:4946), both must come from the cluster: the (unlogged) Raft snapshot install carrieslastApplied=(t:4, i:4945), and the leader's retained log then serves an entry ati:4946with term 3. Since term must be non-decreasing with index in a single log, one of the two is mis-stamped — the obvious suspect is the snapshot'slastIncludedTermbeing stamped with the current term (4) instead of the term of entry 4945 (which, given i:4946 is t:3, must also have been ≤3).Practical consequence: every fresh joiner is poisoned — any node that needs a snapshot-based catch-up from this group crashes in the same loop, so the reformat-and-rejoin escape hatch is dead for this cluster. We're recovering stage with a full parallel reformat (wipe all three + simultaneous force-delete), which rebuilds the group log from index 0.
Environment note for repro: the group went through several rapid term changes during this morning's parallel cold bootstrap (terms 1→4 within seconds, leadership transferred to the freshest copy by BootstrapElection) — the poisoned region of the log presumably dates from that window.
ruispereira commentedon Jul 15, 2026
Per-pod logs from the current state (pod-0 reformatted+recreated again ~09:02, still crash-looping 22 min later), plus a network sanity check. Three additional findings for the record.
pod-0 (crash-looping joiner, IP
10.126.57.187) — same inversion, now at leader heartbeat #19122:pod-1 (leader) — the channel-reset escalation ran its full course against the crash-looping node and then gave up permanently:
Note "unreachable" is misleading here — the node is perfectly reachable. From inside the leader pod:
DNS resolves to the current IP and the network is fine at 0.5ms — the RPCs fail because the target member is
CLOSEDin its 3-second crash window. So the reset-and-give-up path burns its 5 attempts (and its "requires operator intervention" terminal state) on a node whose problem was never the channel. Suggest the monitor distinguish connect-level failure fromServerNotReadyException— resetting the channel can't help the latter, and the give-up leaves a permanent dead appender once the node does recover.pod-2 (healthy follower) — still rejecting the recreated node's new IP against a stale allowlist, minutes after the new pod's DNS record existed:
If the #5268 re-resolve-on-miss fix (
ba8827afe) is supposed to be in this snapshot, it isn't taking effect — three rejections of the same unknown IP over 10 seconds with the correct DNS record in place. Could you confirm whether the current26.8.1-SNAPSHOTdocker tag (our pods run digest8ee87c28…, pulled this morning) already contains the #5268/#5271/#5275/#5276/#5277 commits? If not, part of today's report is us validating a pre-fix build and the only new defect here is the term-inverted snapshot/log state (previous comment) plus the two behavioral notes above.fix(#5291): escalate a non-sticking Ratis crash-loop instead of resta…
lvca commentedon Jul 15, 2026
Thanks for the very detailed report and the follow-up analysis - your finding that the inverted state lives in the group's replicated log (not the node's local storage) was spot on and saved a lot of digging.
There are really two things here:
1. The crash-loop itself (fixed). The follower kept crashing on the term-inverted entry, and the CLOSED-member auto-restart faithfully restarted it into the exact same crash forever, because the restart succeeds (the server starts) and only the background updater dies a moment later - so the existing "give up after N restarts" safety never counted it.
I've changed the health monitor to detect this: after a bounded number of restarts that don't stick, it escalates once to a storage reformat + rejoin (which fixes a purely local corruption), and if the node still crash-loops it stops restarting and logs a single clear SEVERE alert asking for operator intervention - instead of looping ~15x/min indefinitely. Merged to
main, so it'll be in the next26.8.1-SNAPSHOT.2. The inverted log region on the leader. As you found, because the bad state is replicated, a single-node reformat can't help - the leader re-serves it to every fresh joiner. The fix above turns that situation into a loud, quiet-once alert rather than an endless loop, but the recovery for a group whose log is already poisoned remains what you did: a coordinated full-cluster reformat. Reproducing the original corruption (rapid term changes during a parallel cold bootstrap) is hard without the affected storage; if you can capture a
.raft-storagefrom a poisoned node before wiping it, that would help us chase the source.The other two notes (the "unreachable" channel-reset burning its budget on a
CLOSEDnode, and the stale-allowlist rejections) are tracked separately - the allowlist one looks like your image digest predates the #5268 fix, so it's worth confirming the build first.❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
lvca commentedon Jul 15, 2026
Still working on some other issues discovered with this bug hunting...
fix(#5291): stop the leader masking a crash-looping follower as HEALTHY
lvca commentedon Jul 15, 2026
Follow-up on the two behavioural notes from your second comment.
Status masking (fixed). You were right that a crash-looping follower was reported
HEALTHY / lag 0. The leader was deciding health purely from how far behind the follower's log was, and a node that had briefly caught up before it started flapping keeps that "caught up" mark even while it stops answering. The leader now also looks at whether the follower has actually answered a request recently: a follower that looks caught up but hasn't responded within the unreachable threshold is reported as STALLED, not HEALTHY, so the status API, metrics and Studio no longer hide it. Merged tomain.The "unreachable" channel reset. I looked at this one closely and decided to leave it as is. The give-up is only a log line - it re-arms automatically the moment the follower answers again, and it doesn't touch Ratis's own replication channel, so it doesn't leave a dead appender once the node recovers. The leader can't reliably tell "network down" from "member is up but CLOSED" from the data it has here, and changing it risked breaking the real DNS-recovery case it was built for. The wasted reset attempts are harmless (they just rebuild one channel), so it's noisy logging rather than a functional problem - and with the status fix above, that node now shows as STALLED anyway.
Allowlist rejections. These point to your image digest predating the #5268 fix rather than a new bug - worth confirming the build first, as noted earlier.
❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.
fix(#5291): escalate a non-sticking Ratis crash-loop instead of resta…
fix(#5291): stop the leader masking a crash-looping follower as HEALTHY