{
  "id": 22708006,
  "title": "Silent Failure #20: The Stop Button Cancelled a Handle That Was Already None",
  "url": "https://urgent.news/2026/11/30/silent-failure-20-the-stop-button-cancelled-a-handle-that-was-already",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-11-30T02:09:22.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/dafili/silent-failure-20-the-stop-button-cancelled-a-handle-that-was-already-none-2a5i"
  },
  "original_language": null,
  "account": "The story describes a bug discovered in the magitech-ai/anima 2.0 service, which watches files and reloads fibers. The bug occurred when a shutdown request was issued, causing the service to stop prematurely and wake up later with a stashed change, leading to a failed reconciliation. The issue arose because the service cancelled a handle that had been set to None since the watch was installed, causing the flush to wake up unexpectedly and call reconcile() unexpectedly. The bug was caught by a test that printed the input list of every reconcile, revealing a file in the list after stop. The fix was to give the flush task its own slot, self._fs_flush_task, and cancel it through _cancel_fs_flush() in both the stop() and the side-effect disposer. The change was straightforward but still a mistake, as the correct pattern was three lines above the code being edited. The fix included adding a test that captured the disposer actually held by the service, called it, and asserted the live task was cancelled. The author also warns against testing the canceller with a task made up in the test, suggesting instead to register the watch, capture the disposer, call it, and assert the live task is cancelled.",
  "summary": "The last line in my soak log was reconcile after stop: [['a.py']] . The service had been stopped two seconds earlier. The watcher was supposed to be gone, the debounce was supposed to be cancelled, and the reconciler was still walking the tree and printing the file it had picked up. The test I wrote for that exact path was green. That is the part that still stings. I have been fixing lifecycle…",
  "summary_source": "publisher",
  "key_points": [
    "Stop button prematurely halted service, causing failed reconciliation",
    "Handle set to None during shutdown, leading to unexpected wake-up",
    "Fix involved giving flush task its own slot and canceling it"
  ],
  "editors_take": "This bug shows how improper task cancellation can cause services to restart unexpectedly, forcing developers to use more precise patterns when managing file watchers.",
  "opinion": false,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "machine_translated": false,
  "ai_generated": true,
  "disclaimer": "Accounts, briefs, key points, the editor’s take and translations are written by software from other outlets’ reporting and may contain errors. A summary whose summary_source is \"publisher\" is the outlet’s own feed text. Always check the linked original."
}