diff --git a/tractor/_actor.py b/tractor/_actor.py index 0614431..b73781c 100644 --- a/tractor/_actor.py +++ b/tractor/_actor.py @@ -537,11 +537,14 @@ class Actor: async for msg in chan: if msg is None: # loop terminate sentinel + log.debug( f"Cancelling all tasks for {chan} from {chan.uid}") - for (channel, cid) in self._rpc_tasks: + + for (channel, cid) in self._rpc_tasks.copy(): if channel is chan: await self._cancel_task(cid, channel) + log.debug( f"Msg loop signalled to terminate for" f" {chan} from {chan.uid}")