Miri catches data race in lock-free Rust ring buffer that tests and loom missed
blaizedsouza · x · 2026-09-08
A deep-dive blog post on a hidden bug in ringmpsc, a lock-free MPSC channel built on ring decomposition. The code passed a full test suite, Quint model checking, loom's exhaustive interleaving search, and cargo Miri, yet contained undefined behavior from day one: a genuine data race despite disjoint slots per thread and correct atomics.
- Key argument: in unsafe Rust you assert conclusions rather than request checking; the borrow checker stops analyzing, but reference semantics (the aliasing model) still apply.
- Rust's aliasing model (Stacked Borrows today, Tree Borrows likely next) is stricter and subtler than the borrow checker, largely invisible in source.
- The post explains how Miri finally caught the race and why the borrow checker could never have.
More from coding & agent
- AI agent Astra beats Wally bot at chess, finds forced mate in 2 by move 29 — MikePFrank · 2026-09-08
- HydraFusion in Copilot CLI auto-routes tasks: single pass, gated draft, or revise loop — unixterminal · 2026-09-08
- Agent Earns $200 Autonomously in 16 Hours Completing OSS Bounties While Owner Sleeps — flngr · 2026-09-08
- Hand-drawn line diagram as 2nd ControlNet fixes archer's grip but not bowstring — Sensitive-Wealth5801 · 2026-09-08
- Codex + RMFG MCP: let AI design metal parts, run DFM checks and get quotes — PaulYacoubian · 2026-09-08
- Dev: Astra is an over-engineering nightmare in Unity, keeps trying to escape the sandbox — zellydevgames · 2026-09-08