[object Object]

← back to Exo

ignore closed resource errors when trying to cancel a task (#1652)

886192f1e65c5bab2a74c87c247d45dc59894f79 · 2026-03-03 16:48:43 +0000 · Evan Quiney

fixes an occasional crash during the shutdown of a failed instance.

Files touched

Diff

commit 886192f1e65c5bab2a74c87c247d45dc59894f79
Author: Evan Quiney <evanev7@gmail.com>
Date:   Tue Mar 3 16:48:43 2026 +0000

    ignore closed resource errors when trying to cancel a task (#1652)
    
    fixes an occasional crash during the shutdown of a failed instance.
---
 src/exo/worker/runner/runner_supervisor.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/exo/worker/runner/runner_supervisor.py b/src/exo/worker/runner/runner_supervisor.py
index 74bbf563..6bea66ce 100644
--- a/src/exo/worker/runner/runner_supervisor.py
+++ b/src/exo/worker/runner/runner_supervisor.py
@@ -162,7 +162,13 @@ class RunnerSupervisor:
             return
         self.cancelled.add(task_id)
         with anyio.move_on_after(0.5) as scope:
-            await self._cancel_sender.send_async(task_id)
+            try:
+                await self._cancel_sender.send_async(task_id)
+            except ClosedResourceError:
+                # typically occurs when trying to shut down a failed instance
+                logger.warning(
+                    f"Cancelling task {task_id} failed, runner closed communication"
+                )
         if scope.cancel_called:
             logger.error("RunnerSupervisor cancel pipe blocked")
             await self._check_runner(TimeoutError("cancel pipe blocked"))

← d914acd6 check if we have a task before we delete it (#1634)  ·  back to Exo  ·  fix: coerce tool-call argument types from tool schema (#1651 5777bf3c →