Anycast: One IP, Many Locations
Anycast announces a single IP address from multiple geographic locations so routers automatically direct users to the nearest server, improving latency and resilience without client changes.
Fly.ioIncident / postmortem
Fly.io’s fly-proxy, a Rust-based Anycast router, suffered lockups while managing rapidly changing routing state across thousands of servers. An earlier outage came from an if let expression that kept a read lock through both branches, while later regionalization and lazy loading increased write contention in the Catalog. The investigation traced the new failures to parking_lot’s try_write_for wakeup path: after a waiting writer timed out, it attempted to clear WRITER and WRITER_PARKED together even though one bit had already been cleared, and wrapping arithmetic produced the corrupted lock value 0xFFFFFFFFFFFFFFFE. The parking_lot team fixed the defect, after which the lockups did not recur; the team also audited Catalog locking, removed if let patterns and RAII lock guards, and added lock-timing metrics, labeled slow-write logs, and holder tracking.
fly-proxy distributes and uses routing state for Fly Machines across thousands of servers. Its Catalog is an in-memory aggregation of Corrosion data, accessed concurrently by many readers and writers. Regionalization and lazy loading changed those access patterns, introducing more writer contention and exposing failures that appeared as lockups.
The investigation used a minimal reproduction with a forked parking_lot that confirmed and logged the faulty condition. The lock implementation was fixed so the writer bit is cleared separately in the same wakeup queue as the reader. Catalog locking was also audited, with lock timing, labeled slow-write logs, and write-lock holder tracking added for future diagnosis.
The Catalog’s read-write locking became more contended as regionalization expanded lazy loading, making the failures appear to be deadlocks even though the underlying issue was a lock implementation defect.
parking_lot’s try_write_for path could clear WRITER and WRITER_PARKED together after WRITER_PARKED had already been unset. The resulting wrapping arithmetic corrupted the lock word to 0xFFFFFFFFFFFFFFFE.
After the fix, lockups did not recur. The team also stopped relying on if let lifetimes and RAII lock guards, enabling lock timing and contextual write-holder diagnostics.
Summaries are generated from the original by a language model. Check the original before relying on it.
See the idea
Anycast announces a single IP address from multiple geographic locations so routers automatically direct users to the nearest server, improving latency and resilience without client changes.
Keep reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
One useful email. Unsubscribe anytime.