Breakwater 1.0 fixes distributed circuit breaker race condition with fencing tokens
Developer Oren released Breakwater 1.0, a Node.js resilience toolkit featuring retry, circuit breaker, timeout, bulkhead, and rate limiting capabilities with shared state across service instances. The 1.0 release centers on fixing a critical bug caused by the ABA problem, where a stale circuit-breaker decision made during one half-open period could incorrectly reopen the circuit during a completely separate, already-recovered half-open period. An initial patch using compensating compare-and-set swaps was shipped but acknowledged as unreliable, since two swaps cannot atomically replicate the safety of one. The final fix introduced monotonic fencing tokens into the store contract, so any transition attempt carrying an outdated token is rejected atomically by Redis via a Lua script. This approach eliminated the race window entirely and simplified the codebase, marking the core architectural improvement that defined the 1.0 milestone.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in