Skip to content

HA/k8s: recreated follower permanently stranded — one-shot KubernetesAutoJoin rejected by stale PeerAddressAllowlistFilter; leader never re-contacts it (follow-up to #4696) #5268

Closed

Description

@ruispereira

Follow-up to #4696 / #5020. The wedged-appender auto-reset shipped in 26.7.2 fixed the scenario we originally reported (confirmed at the time on a 26.7.2 snapshot), but on 26.8.1-SNAPSHOT we hit a different stranding mode for a recreated follower: the follower's one-shot Kubernetes auto-join is rejected by the peers' stale PeerAddressAllowlistFilter, the follower concludes "no existing cluster found" and never retries, and the leader never re-establishes its channel either — the node stays NOT_READY (readiness 503 via readinessRequiresHA=true) indefinitely — 27+ minutes and counting at the time of filing, with no sign of self-healing.

Environment

  • ArcadeDB 26.8.1-SNAPSHOT, Raft HA, 3-node StatefulSet on Kubernetes (EKS)
  • Note: the snapshot tag is mutable and the three pods were started days apart, so they run different snapshot builds:
    • arcadedb-0 (leader, up 3d22h): sha256:51a6e894…
    • arcadedb-1 (the recreated follower, pulled 2026-07-14): sha256:f42e5a70…
    • arcadedb-2 (up 3d21h): sha256:777fbc52…
  • podManagementPolicy: Parallel; -Darcadedb.server.readinessRequiresHA=true; arcadedb.ha.peerChannelResetDuration left at default (60s)

DNS configuration already in place on our side

All the DNS mitigations discussed in #4696 are applied in this deployment:

  • JVM DNS caching disabled/shortened (passed via ARGS):

    -Dsun.net.inetaddr.ttl=30
    -Dsun.net.inetaddr.negative.ttl=0
    

    So a stale or negative JVM-level DNS cache entry lives at most 30s / 0s — the >18 min strand cannot be explained by JVM DNS caching.

  • Headless Service publishes records for not-Ready pods, so a recreated pod's per-pod DNS record (with its new IP) exists as soon as the pod has an IP, well before it becomes Ready:

    kind: Service
    spec:
      clusterIP: None
      publishNotReadyAddresses: true

    We verified this works: nslookup of the recreated pod's FQDN from inside the peers returned the correct new IP while the pod was still 0/1. The stale data is ArcadeDB's cached allowlist/channel state, not Kubernetes DNS.

  • Peers are addressed by stable per-pod FQDNs (never by IP) in the HA config:

    -Darcadedb.ha.k8s=true
    -Darcadedb.ha.serverList=vcc-superx-arcadedb-0.vcc-superx-arcadedb.<ns>.svc.cluster.local:2434:2480,vcc-superx-arcadedb-1...:2434:2480,vcc-superx-arcadedb-2...:2434:2480
    -Darcadedb.ha.k8sSuffix=vcc-superx-arcadedb.<ns>.svc.cluster.local
    -Darcadedb.ha.raftPort=2434
    -Darcadedb.ha.replicationIncomingHost=0.0.0.0
    

Timeline (UTC, 2026-07-14)

Pod arcadedb-1 was deleted/recreated twice while arcadedb-0 stayed leader throughout:

Round 1 — recreated ~09:19, old IP 10.126.54.167 → new IP 10.126.37.253:

# arcadedb-2 (same on other peers), while the pod's DNS record was briefly absent:
09:19:45 WARNI [PeerAddressAllowlistFilter] Cannot resolve cluster peer host 'vcc-superx-arcadedb-1...' for Raft gRPC allowlist: Name does not resolve
09:20:15 WARNI [PeerAddressAllowlistFilter] Cannot resolve cluster peer host 'vcc-superx-arcadedb-1...' for Raft gRPC allowlist: Name does not resolve
# then the new incarnation's inbound connections were rejected against the stale allowlist:
09:20:24 WARNI [PeerAddressAllowlistFilter] Rejecting Raft gRPC connection from non-peer address: 10.126.37.253 (allowed=[::1, 10.126.54.167, 10.126.31.4, 10.126.34.96, ...])
09:20:31 WARNI [PeerAddressAllowlistFilter] Rejecting ... 10.126.37.253 ...
09:20:41 WARNI [PeerAddressAllowlistFilter] Rejecting ... 10.126.37.253 ...

That incarnation never became Ready in ~27 min, so we deleted it again.

Round 2 — recreated ~09:46, IP 10.126.37.253 → 10.126.42.118:

# arcadedb-1 boots cleanly:
09:46:39.346 INFO [RaftHAServer] RaftHAServer configured: cluster='arcadedb', localPeer='vcc-superx-arcadedb-1..._2434', peers=3
09:46:39.926 INFO [RaftHAServer] Raft cluster joined: 3 nodes [...]

# arcadedb-2, at the exact moment arcadedb-1 probes for the existing cluster —
# note the allowlist now contains the ROUND-1 IP (10.126.37.253), one incarnation behind:
09:46:42.101 WARNI [PeerAddressAllowlistFilter] Rejecting Raft gRPC connection from non-peer address: 10.126.42.118 (allowed=[::1, 10.126.31.4, 10.126.37.253, 10.126.34.96, ...])

# arcadedb-1, same second — the rejection surfaces as "no cluster", and this is the LAST
# HA-related line it ever logs (single attempt, no retry):
09:46:42.107 INFO [KubernetesAutoJoin] K8s auto-join: no existing cluster found. This node will participate in Raft leader election with the configured peer group once peers are reachable

18+ minutes later — no self-healing:

  • arcadedb-1 /api/v1/cluster: "leaderId": null, "electionCount": 0 — it never heard from the leader.
  • arcadedb-0 /api/v1/cluster: "isLeader": true, lists arcadedb-1 as FOLLOWER (static peer list).
  • arcadedb-1 readiness stays 503; no rejection ever logged on its own side, no error, nothing to alert on.
  • No further Rejecting ... lines on the peers after 09:46:42 — consistent with arcadedb-1 having tried exactly once.

Analysis — three gaps compound

  1. KubernetesAutoJoin is one-shot and fails silently. It probes the peers once, ~3s after Raft init. If that single probe lands inside the stale-allowlist window (which it reliably does — the pod boots in ~40s, and 50s after pod creation the peers' allowlist still held the previous incarnation's IP), the node concludes "no existing cluster found" and parks forever. Nothing on the joining side indicates a rejection occurred; you only find it by grepping the other pods.

  2. PeerAddressAllowlistFilter rejects unknown IPs against a cached resolution. On Kubernetes, a recreated pod having a new IP is the normal case, not an intrusion. A connection from an unknown source IP could trigger an immediate re-resolve of the configured peer hostnames before rejecting (re-resolve-on-miss), instead of waiting for the periodic refresh. Related to [HA] PeerAddressAllowlistFilter rejects legitimate peers during k8s DNS-resolution race (incomplete allowlist on startup/restart) #4471 / PeerAddressAllowlistFilter fail-open lasts the full startup grace window if any peer host never resolves #4828, but this is specifically the "reject during the refresh gap strands a joiner" case.

  3. The fix: [#4696] HA/Raft auto-reset a follower's wedged replication chann… #5020 leader-side channel reset appears to give up permanently. Per the fix description it "retries a few times, then gives up and logs for operator attention". Our hypothesis: the leader exhausted its reset attempts during Round 1 (the 09:19–09:46 window, first incarnation never joinable) and was no longer attempting anything when the Round 2 incarnation appeared — so the recovered follower was never contacted, and leaderId stayed null on it. We unfortunately cannot confirm from leader logs: the leader's log was rotating within seconds due to an unrelated flood of ServerSecurityDatabaseUser "Requesting access to fileId 124 which is not yet in security configuration (registeredFiles=30), allowing by default" lines (thousands/sec; will file separately). If the give-up is permanent per-peer, any follower outage longer than the retry budget becomes a permanent strand requiring manual leadership transfer — same operator burden HA/Raft: peer recovery stalls after Kubernetes pod-IP change (no auto-recovery of wedged appender channel; allowlist refresh is reactive-only) #4696 was about.

Suggested improvements

  • KubernetesAutoJoin: retry with backoff (or periodically while leaderId == null and the node is not Ready) instead of one-shot. This alone would have healed our case — the peers' allowlist did refresh to the new IP shortly after.
  • PeerAddressAllowlistFilter: on a connection from an unknown IP, re-resolve peer hostnames synchronously and re-check before rejecting.
  • Leader channel reset (fix: [#4696] HA/Raft auto-reset a follower's wedged replication chann… #5020): re-arm the reset when the peer's DNS resolution changes (or never give up while the peer remains in the configured peer group), instead of a finite give-up.
  • Observability: log a clear join rejected by peer <X> on the joining node and surface a join-rejected / stranded-follower alert in /api/v1/cluster — today the failure is completely silent on the affected node.

Workaround

Restarting the leader (or POST /api/v1/cluster/leader leadership transfer) heals it: the new leader dials all peers fresh and the stranded node rejoins.

Activity

  1. ruispereira commented on Jul 14, 2026

    @ruispereira
    ContributorAuthor

    The ServerSecurityDatabaseUser log flood that prevented us from inspecting the leader's logs (point 3 above) is now filed separately as #5269.

  2. ruispereira commented on Jul 14, 2026

    @ruispereira
    ContributorAuthor

    Additional data point from a normal rolling update today (3-node StatefulSet, same environment): the k8s auto-join failed on all 3 of 3 rejoins. Each recreated pod logged K8s auto-join: no existing cluster found (~40s after container start), and the surviving peers logged the corresponding PeerAddressAllowlistFilter rejections of the new pod IP — the allowlist refresh loses the race against the one-shot join probe essentially every time in this environment.

    The rollout still succeeded, but only because the active leader had healthy channels and dialed each recreated pod's FQDN itself (re-resolving DNS) — i.e. recovery currently depends 100% on the leader-side dial-in and 0% on the auto-join. When the leader's channels are degraded (the scenario in this issue and #5271), that safety net is gone and the join failure becomes a strand. A retry in KubernetesAutoJoin (or re-resolve-on-miss in the allowlist filter) would make the join path self-sufficient.

  3. ruispereira commented on Jul 14, 2026

    @ruispereira
    ContributorAuthor

    Cleanest repro yet — the leader's appender for a recreated follower silently vanishes.

    Single-pod recreation of a follower (arcadedb-2), everything else healthy, no log noise this time. 10+ minutes later the follower is still NOT_READY with leaderId: null. The new evidence is the leader's own /api/v1/cluster:

    {"id": "...arcadedb-0...", "role": "FOLLOWER", "matchIndex": 812, "nextIndex": 813,
     "replicationLag": 0, "lastContactMs": 1896, "replicaStatus": "HEALTHY", "lagging": false}
    {"id": "...arcadedb-2...", "role": "FOLLOWER"}   <-- no matchIndex, no replicaStatus, nothing

    The healthy follower has full replication telemetry; the recreated one has no appender-side fields at all. So after the pod delete the leader's GrpcLogAppender for that peer apparently terminated and was never recreated — which explains why there is no ClusterMonitor ... unreachable line, no peerChannelResetDuration reset (there is no channel left to reset), and no alert: the monitoring appears to track only live appenders, so a dead appender is a blind spot.

    Also note, this run had none of the previously reported noise: no allowlist rejections (the follower never probed — it resumed from persisted Raft storage, so KubernetesAutoJoin did not run), leader logs completely clean. The follower resumed its persisted log, sat waiting for a leader, and never election-timed-out into candidacy either (electionCount stays 0).

    So the minimal statement of the bug: delete one follower pod and, if the leader's appender dies instead of reconnecting, nothing in the system ever tries again — not the leader (dead appender, no monitor), not the follower (no join retry, no self-election). Suggested invariant: while a configured peer has no live appender, the leader should recreate it on a timer (and /api/v1/cluster should flag a configured FOLLOWER with no replication telemetry instead of listing it as a plain follower).

  4. ruispereira commented on Jul 14, 2026

    @ruispereira
    ContributorAuthor

    Follow-up with leader-side evidence that narrows the defect precisely:

    The #5020 reset works — but only while the appender object exists. Same leader, same hour, two followers restarted:

    • Follower A (arcadedb-0, restarted during a rolling update): textbook recovery — ClusterMonitor ... unreachable (no successful RPC for 15017ms) → still unreachable for 30000ms → 60000ms; triggering a replication-channel reset (attempt 1/5) to force a fresh DNS re-resolution → reconnected after 70000ms; replication resuming.
    • Follower B (arcadedb-2, single pod delete ~10 min later): the leader's ONLY line ever is PeerAddressAllowlistFilter: Cannot resolve cluster peer host '...arcadedb-2...' (logged during the brief DNS gap while the pod was being recreated) — and then permanent silence: no unreachable ticks, no reset attempts, and /api/v1/cluster shows the peer with no appender telemetry at all (see previous comment). The appender apparently died on the DNS-gap UnknownHostException and was never recreated, and ClusterMonitor only watches live appenders, so the 15s/30s/60s escalation never even starts.

    Leadership changes don't recreate it either. We tried the #4696 workaround: POST /api/v1/cluster/leader with an explicit target. Three observations:

    1. Without a JSON body the endpoint returns a bare 500 (nothing logged server-side).
    2. With {"target": "<peer-id>"} it returned {"result":"Leadership transferred"} — but leadership did NOT move: the old leader logged Leader churn: ... re-elected (term=4) and stayed leader. Success response, no actual transfer.
    3. Even after that re-election (RaftClient refreshed with fresh gRPC channels after leader change), the stranded peer's entry still has no appender telemetry — so whatever path recreates appenders on leadership change also skipped the dead one.

    So the failure condition is: if the appender for a peer dies while that peer's DNS is momentarily unresolvable (the normal k8s pod-recreation window), no mechanism — monitor, reset, or re-election of the same leader — ever recreates it. Only moving leadership to a different node (fresh LeaderState) or restarting the leader clears it.

    Environment note: this is with the peer's Raft storage now persisted (our chart pins raftStorageDirectory to the PVC), so the recreated follower resumes its log and KubernetesAutoJoin doesn't run at all — the follower sits waiting for a leader that will never dial, and never election-times-out on its own (electionCount stays 0 for 20+ min).

  5. ruispereira commented on Jul 14, 2026

    @ruispereira
    ContributorAuthor

    Correction/root cause — the peer is silently REMOVED from the Raft configuration. The RaftClusterStatusExporter dumps on the leader nail it:

    13:33:15 CLUSTER CONFIGURATION (term=3, commitIndex=750)   <- during the rolling update
      arcadedb-0  Follower
      arcadedb-1  Leader
      arcadedb-2  Follower        <- still a member
    
    13:52:40 CLUSTER CONFIGURATION (term=4, commitIndex=872)   <- after arcadedb-2's pod delete (~13:39)
      arcadedb-0  Follower  HEALTHY
      arcadedb-1  Leader
                                  <- arcadedb-2 is GONE from the group
    

    Between those two dumps the only relevant event was the single pod delete of arcadedb-2. No log line records the removal — grepping the leader for setConfiguration/membership/remove finds nothing. So my earlier "appender died" framing was the symptom, not the cause: there is no appender because the peer is no longer in the Raft configuration (presumably a k8s watcher treating the transient pod deletion as a permanent scale-down and issuing a member removal).

    That closes the loop on why nothing recovers:

    • Leader: won't dial a non-member; ClusterMonitor has nothing to watch; re-election changes nothing.
    • Follower: comes back with persisted Raft storage that says "I'm a member of the 3-node group", so KubernetesAutoJoin (which would re-ADD it) doesn't run; it waits forever for a leader that will never come. /api/v1/cluster on the OTHER nodes still lists it as a FOLLOWER (static list), masking the removal.

    Suggested fixes on top of the earlier ones: (1) never remove a StatefulSet peer from the Raft configuration on pod deletion (the pod name will come back by construction; treat it as unreachable, not gone) — or at minimum log the removal at WARNING; (2) on startup with persisted Raft storage, verify the node is still part of the group's current configuration (ask the peers), and if not, fall back to the auto-join/re-add path instead of waiting passively.

    Two smaller bugs found while applying the #4696 workaround, logged here for completeness: POST /api/v1/cluster/leader without a body 500s with an NPE (PostTransferLeaderHandler ... \"payload\" is null) instead of a 400; and with a valid target it returned {"result":"Leadership transferred"} while leadership actually bounced back to the same node (term=4 re-election of the incumbent).

  6. added this to the 26.8.1 milestone on Jul 14, 2026
  7. self-assigned this
    on Jul 14, 2026
  8. added theissue type on Jul 14, 2026
  9. added a commit that references this issue on Jul 14, 2026
  10. lvca commented on Jul 14, 2026

    @lvca
    Member

    Fixed in main (commit ba8827a), shipping in 26.8.1 - together with #5275, which turned out to be the root of the worst cases here.

    Three changes make the join path self-sufficient:

    • Allowlist re-resolve-on-miss (your suggestion): a connection from an unknown IP now triggers an immediate DNS re-resolution (rate-limited to once per second) before rejecting, instead of waiting out the 30s refresh interval. Your trace showed exactly why the race was lost essentially every time: the DNS-gap lookups during the pod recreation kept resetting the refresh timer, so the new pod's probe always landed inside the window.
    • Auto-join retries with backoff (2s doubling to 60s) on a background thread until the node joins or a leader becomes visible, instead of one shot.
    • The failure is no longer silent on the affected node: per-peer probe failure reasons are logged at WARNING where the problem is, not just on the other pods.

    Also worth knowing: the "dead appender" you tracked down was the silent configuration removal (#5275), so with that fixed the leader always has a live appender for a configured peer - and the probe itself had a bug that made it fail even without the allowlist race (detailed in #5275).


    ❤️ 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.

  11. added a commit that references this issue on Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions