{
  "id": 1084024,
  "title": "\"half-open\" twice is not the same state: the bug that shaped breakwater 1.0",
  "url": "https://urgent.news/2026/08/15/half-open-twice-is-not-the-same-state-the-bug-that-shaped-breakwater",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-15T17:19:55.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/pinceladasdaweb/half-open-twice-is-not-the-same-state-the-bug-that-shaped-breakwater-10-4m6c"
  },
  "original_language": "en",
  "account": "Half-open is not the same as open in the context of a circuit breaker. A state machine with closed, open, and half-open states is used to protect transitions. However, sharing the same state name across multiple instances creates challenges. The issue arises when a half-open state transitions to open due to a probe failing, while another instance succeeds and closes the circuit. This race condition, reminiscent of the ABA problem, can lead to incorrect decisions and disrupt recovery. The author initially fixed the issue by checking the state after a swap, but this only provided a \"best effort\" solution. The true fix involved introducing a fence, a monotonic token minted by the store with every successful transition. This ensures that a swap only occurs if no other transitions have occurred since the fence was read. The store also owns the timing for the cooldown, preventing discrepancies between instances. Additionally, the author discovered that a promise never resolving is worse than an error. When Redis is down, an ioredis configuration with enableOfflineQueue enabled can lead to indefinite waiting for a breaker execution, rather than triggering a fallback or error. This demonstrates the importance of proper error handling and resilience in distributed systems.",
  "summary": "breakwater is my resilience toolkit for Node.js — retry, circuit breaker, timeout, bulkhead, rate limiting, stale-while-open caching, all composable, with observability built in. It just hit 1.0.0 , and the headline feature is the one no Node library did well: a circuit breaker whose state is shared across every instance of your service . One instance sees the outage and trips the breaker. The…",
  "key_points": [
    "Half-open state differs from open state in circuit breaker",
    "Race condition occurs when half-open transitions to open",
    "Fence introduced to prevent incorrect decisions in state transitions"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}