DDM drops updates when in solicit state.

Aperta
#985 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
43/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
networking

Direzione di ricerca

Start with ddm/src/sm/state.rs, especially the Solicit peer-event handler and the Exchange entry path; then trace how ddm/src/exchange/runtime.rs delivers updates. The issue identifies dropped Push events and lists candidate fixes, but leaves the design choice open. Done means a prefix learned during this timing window reaches the peer and is covered by a regression test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug ddm

I ran into this while testing https://github.com/oxidecomputer/omicron/pull/11684 on voxel, which changes the timing around RSS a bit and induces the race.

🤖 did a thorough analysis:

RSS handoff to Nexus wedged by a missing DDM route (g1 → g2)

Rack: voxel 4-sled (g0,g3 scrimlets; g1,g2 gimlets), launched 2026-11-04 16:00 UTC
Rack UUID: 85e4096f-1593-402b-b22f-9ecc3ea2c1ea
Symptom: RSS never completes handoff; retries every ~60s since 16:17:42, still failing at 16:50.

Handoff is a symptom. The defect is in DDM prefix propagation: g2 never learned g1's underlay
prefix
, which partially partitions CockroachDB and starves Nexus of DB connections.


Causal chain

1. g2 is missing the route to g1's underlay prefix

netstat -rn -f inet6:

sled has 102::/64 (g1) has 103::/64 (g2)
g1 local yes, via both switches
g2 absent local

g2 is also missing fd6c:ef99:c06e:2::/64 (g1's bootstrap prefix). Every other
c06e:10x::/64 is present on g2.

Result is a one-way partition that fails in both directions, because g2 cannot route replies:

from n2 (g1, 102::3):   101::3 OK   103::3 FAIL   104::3 OK   104::4 OK
from n4 (g2, 103::3):   101::3 OK   102::3 FAIL   104::3 OK   104::4 OK
2. This is a propagation gap, not a session failure
  • g1 advertises correctly — ddmadm get-originated on g1:
    fd6c:ef99:c06e:102::/64, fd6c:ef99:c06e:2::/64, fdb0:a840:2500:3::/64
  • Both switch zones have learned it — ddmadm get-prefixes in oxz_switch on g0 and g3 each
    show all four of 101::/64 (g0), 102::/64 (g1), 103::/64 (g2), 104::/64 (g3)
  • g2's ddmadm get-prefixes shows prefixes originated by g0 and g3 only, over both
    sw2FAKE000 and sw2FAKE003. Nothing from g1.
  • All DDM sessions are healthy and in Exchange.

So the switches know the route and simply never relayed it to g2.

Peer-session ages on g0's oxz_switch (at time of capture):

g0  Server  Exchange  42m 53s
g3  Server  Exchange  42m 54s
g1  Server  Exchange  37m 52s
g2  Server  Exchange  37m 45s

g0's and g3's prefixes (learned ~42m ago) did reach g2, so initial full-table sync works.
g1's session came up only ~7s before g2's. This is a race — see
root cause below.

3. CockroachDB takes a partial partition

n4 (g2) cannot reach n2 (g1). From n4's cockroach.log, continuously:

side-transport failed to connect to n2: unable to dial n2: ‹breaker open›
could not successfully add and upreplicate LEARNER replica(s) on [n2,s2],
  rolling back: unable to dial n2: ‹breaker open›

cockroach node status still reports all 5 nodes is_live and is_available, because
n1/n3/n5 can reach everyone. Partial partitions are the pathological case — liveness looks fine
while work silently stops.

Node → sled map:

node address sled
n1 fd6c:ef99:c06e:101::3 g0
n2 fd6c:ef99:c06e:102::3 g1
n3 fd6c:ef99:c06e:104::3 g3
n4 fd6c:ef99:c06e:103::3 g2
n5 fd6c:ef99:c06e:104::4 g3
4. Ranges wedge behind an unpushable transaction

28 open transactions, all 28 with a blocked active query, oldest ~31 min. Only 6 contention
events, so this is not ordinary contention.

crdb_internal.cluster_locks where contended:

table range granted count
ip_pool 153 false 12
inv_collection 93 false 5
inv_collection 93 true 1
bp_omicron_zone_nic 209 true 1
bp_omicron_zone_nic 209 false 1
ip_pool 153 true 1

Holders:

holds lock on held for holder's current query
inv_collection 31m46s INSERT INTO inv_host_phase_1_active_slot(...) (blocked)
ip_pool 30m42s INSERT INTO bp_omicron_zone_nic(...) (blocked)
bp_omicron_zone_nic 31m58s none — txn 461f9f5d-f06b-4a4a-8f7c-deb5a0bfc87f has no row in cluster_transactions

The root blocker has no coordinator record and is not being pushed/aborted, so the chain never
unwinds. Replica sets are all intact (r153 {1,3,4}, r93 {1,2,3,4,5}, r209 {1,2,3,4,5}) and
lease_holder for r153 resolves instantly to n4 — this is not a quorum or lease problem.

Reads are affected per-table, which is what pointed at locks rather than a dead node:

rack                       0s -> 1
sled                       0s -> 4
service_network_interface  1s -> 0
ip_pool                    timeout
inv_collection             timeout

ip_pool hangs identically through all five gateway nodes. SELECT 1 is instant.

5. Nexus's connection pool drains, handoff 503s

Every Nexus request now fails:

error_message_external: "Service Unavailable"
error_message_internal: "Failed to access DB connection: Backends exist, and appear online,
                         but all claims are used"
response_code: 503     latency_us: 30001867

52 CRDB sessions from Nexus, all claims held by blocked queries.

RSS, sled-agent/rack-setup/src/service.rs:924:

"Failed to handoff to nexus"
PUT http://[fd6c:ef99:c06e:101::5]:12232/racks/85e4096f-.../initialization-complete
  → 503 ServiceNotAvailable   (and, intermittently, "operation timed out")

The request does reach Nexus and authorizes successfully — it then blocks on the DB and times out.


Root cause: a 7-second window in the DDM exchange FSM

Source read at maghemite 6fee306 — the commit omicron pins for mg-ddm / mg-ddm-gz
(package-manifest.toml, tools/maghemite_ddm_openapi_version). Still unfixed on
origin/main (2b157ac); the two commits since do not touch ddm/src/{sm,exchange,discovery}.

There are exactly two ways a sled learns a prefix, and both are one-shot

ddmd runs one FSM per link. On the switch (mode = transit, per svcprop -p config mg-ddm)
the four sled-facing FSMs are cross-connected by a static channel mesh built once at
startup — ddmd/src/main.rs:312, "Add an event channel sender for each state machine to
every other state machine."

  1. Pull. On entering Exchange, an FSM spawns initial_pull, which GETs /v3/pull from
    the peer. The transit router's pull_handler (ddm/src/exchange/runtime.rs:456) answers
    with its entire db.imported(). This is the full-table sync — but it fires only on
    Exchange entry. The only other trigger is AdminEvent::Sync
    (ddm/src/sm/state.rs:699), reachable just from the admin API. Nothing re-pulls
    periodically.

  2. Push. When a transit FSM imports something, handle_update
    (runtime.rs:528) sends PeerEvent::Redistribute to its own FSM, whose handler
    (state.rs:833) breaks loops, appends the router ID, and fans a PeerEvent::Push out
    across the channel mesh. Each sibling FSM then calls announce_underlay to its own peer.

There is a third path, AdminEvent::NewExternalPeer (state.rs:716), where an FSM pushes its
whole db.imported() to a newly-arrived peer. It is gated on self.ctx.iface.external, and
ddmadm get-external-peers on both switches returns empty. Rear ports are not external, so
this never fires here.

The window: Solicit silently discards peer events

state.rs:770:

Event::Peer(e) => {
    wrn!(self.log, self.ctx.config.if_name,
         "peer event in solicit state: {:?}", e);
}

A Push that arrives while the destination FSM is still in Solicit is logged and dropped.
It is never retried, and since the peer has already done its one pull, nothing else will ever
carry that prefix.

Measured timeline

ddmadm get-peers reports time-in-current-state, so entry times are exact. Captured
17:53:24 UTC (switches) and 17:52:53 UTC (sleds):

FSM duration entered Exchange
sw2FAKE000 → g0 1h41m52s 16:11:32
sw2FAKE000 → g3 1h41m53s 16:11:31
g2 → both switches 1h36m51s 16:16:02
g1 → both switches 1h36m19s 16:16:34
sw2FAKE000 → g1 1h36m51s 16:16:33
sw2FAKE000 → g2 1h36m44s 16:16:40
sw2FAKE003 → g1 1h36m52s 16:16:32
sw2FAKE003 → g2 1h36m42s 16:16:42

Note the direction skew: g2's FSM reached Exchange 38 s before the switch's FSM for g2 did.
Discovery is solicit/advertise per direction, so the two halves of a session come up
independently — that is what opens the window.

Replaying it:

  • 16:16:02 — g2 pulls the switch's table. The switch holds g0's and g3's prefixes only.
    g2 installs 101::/64 and 104::/64. This is g2's one and only pull.
  • 16:16:33 — the switch's g1 FSM enters Exchange, pulls from g1, imports 102::/64,
    and fans out a Push. The switch's g2 FSM is still in Solicit for another 7 s.
    The announcement to g2 is dropped on the floor.
  • 16:16:40 — the switch's g2 FSM enters Exchange, pulls from g2, imports 103::/64,
    fans out a Push. The g1 FSM has been in Exchange since 16:16:33, so g1 receives it
    and installs 103::/64.

That asymmetry — g1 has g2's prefix, g2 lacks g1's — is the exact state observed, and it
reproduced independently on both switches (7 s window on sw2FAKE000, 10 s on sw2FAKE003).

The switch-zone log can't corroborate the dropped-Push warning directly:
/var/svc/log/oxide-mg-ddm:default.log begins at 16:23:09, after the event, and config/log
is info, which filters the dbg! "redistributing update to N peers" line.

Why this isn't just a startup curiosity

The same window reopens on any mid-life session reset: an FSM that re-enters Exchange pulls
from its peer but never re-sends its own table, and the peer has no reason to re-pull. A failed
announce_underlay expires the peer back to Solicit (state.rs:762, state.rs:790), which
is itself a way to land in the lossy state.

Candidate fixes, roughly in order of invasiveness: queue or replay peer events received in
Solicit instead of dropping them; have a transit FSM push db.imported() on every Exchange
entry, not only for external interfaces; or add a periodic reconcile pull.

Remediation

ddmadm sync makes every local FSM re-pull from its peer (ddm/src/admin.rs:421 →
AdminEvent::Sync). Run it on g2 and it will re-pull both switches, both of which already
hold 102::/64, installing the missing route — no daemon restart, no session flap:

ddmadm sync      # in g2's global zone

That should restore n2↔n4, let the wedged transactions resolve, free Nexus's pool, and allow
RSS's next retry to succeed.

Not yet attempted — rack left untouched.

Lingua principale
Rust
Stelle
100
Fork
8
Merge medio
2g 1h
PR unite (30g)
18

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di oxidecomputer/maghemite

Tutte le issue di oxidecomputer/maghemite

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.