Corrosion
Corrosion is Fly.io's open-source service discovery system: a Rust program that propagates a SQLite database across thousands of workers via SWIM gossip and QUIC, using the cr-sqlite CRDT extension with last-write-wins logical timestamps instead of distributed consensus. It works because Fly's orchestration makes individual workers the source of truth for their own state, so updates rarely conflict, much like a link-state routing protocol such as OSPF. The war stories cover a Rust RwLock deadlock gossiped to every proxy that caused a fleet-wide outage, a nullable-column migration that triggered a cr-sqlite backfill storm, and Consul certificate expiry that drove Corrosion writes until uplinks saturated. The fixes are Tokio event-loop watchdogs, Antithesis testing, checkpoint backups for cluster rebuilds, republishing full Machine state instead of partial updates, and regionalized two-level clusters to shrink the blast radius.
Related posts
- parking_lot: ffffffffffffffff...
Fly.io hardMasterFly.io's Rust Anycast router, fly-proxy, kept deadlocking after Catalog state was moved to lazy loading. The cause was traced to parking_lot RwLock words being set to 0xFFFFFFFFFFFFFFFF. The hunt ran from a known if-let lock-lifetime footgun through closure-scoped lock refactors with timeouts and telemetry, parking_lot's deadlock detector, gdb core-dump inspection, read_recursive experiments and miri. Core dumps showed threads waiting on a lock nobody held, and logging the raw lock word revealed every bit set, including the unused UPGRADEABLE flag. The post also covers Corrosion, Fly.io's CRDT-structured SQLite replicated over SWIM gossip, and the watchdog that bounces stuck proxies to keep deadlocks survivable.
- Skip the API, Ship Your Database
Fly.io mediumAdeptInstead of designing an API for internal services, Fly.io ships them a read-only SQLite replica via LiteFS, letting consumers query and join data with plain SQL. The pattern emerged from running Corrosion, Fly's gossip-based state store, on LiteFS, where a one-way replica avoided chatty gossip and needed only a small static-lease config. It moves query compute onto each client, which removes rate limiting and multi-tenant resource contention. The tradeoffs are that writes still need an API, the schema becomes a looser contract (mitigated with backward-compatible changes and views), and access control requires per-tenant databases.
- Throwing Out The Phonebook
Fly.io hardMasterFly.io rebuilt 6PN, its private IPv6 network between Fly Machines, replacing a fleet-wide eBPF map of every migrated Machine's location (hundreds of thousands of entries kept in sync from Corrosion's gossip-replicated SQLite) with lazy, on-demand routes. VXLAN's netlink event for unknown addresses is passed through drift-agent to s6pnforwarderd, which queries local Corrosion and installs a single kernel route. Each host now carries only 100–200 routes, addresses no longer need rewriting, and routes can forward through intermediate hosts to tolerate stale entries or steer around bad links. udp-xdp now only validates same-network traffic and sets an fwmark so the design fails closed. The costs are a roughly one-second first-connection delay from TCP retransmission and broken new conversations if the daemons crash. The migration ran both paths side by side behind per-host flags, tolerating asymmetric routing.
- Lights Out, Systems On: Validating Instant Power Loss Readiness
Meta Engineering easyNoviceInstantaneous PowerLoss Storm is Meta's disaster-readiness exercise that cuts power to an entire data center region with zero notice, then validates that storage, compute and the Twine orchestrator can bootstrap autonomously. Two bootstrapping hazards had to be fixed. Circular dependencies among control-plane services are caught with Belljar tests in CI/CD and broken with a Twine recovery kit (Twrko). A "boomerang" problem, where power-related unavailability events shut down the orchestrator itself, was solved by having control-plane services ignore those shutdown signals. Meta defined data loss, facility damage and cross-region impact as unacceptable while tolerating transient errors and bounded staleness, then rolled out the tests incrementally: pre-production regions, then shadow regions, then small production regions, and finally large ones.
- How we use formal modeling, lightweight simulations, and chaos testing to design reliable distributed systems
Datadog Engineering hardMasterDatadog validated the design of Courier, a multi-tenant message queue built on multiple FoundationDB clusters after its March 2023 outage, by combining TLA+ formal modeling, lightweight simulations and chaos testing. Each tenant is sharded across 4 of 8 FoundationDB clusters so that no two tenants share the same set, and brokers health-check clusters and route around failures. The TLA+ spec models brokers, senders and receivers with weak fairness, and TLC checks properties such as at-least-once delivery across every reachable state. Simulations then cover what model checking cannot, such as latency, cost and scalability. Together these give design-level confidence that unit tests miss, at the cost of keeping models and simulations in sync with the design.