# Asyncio broadcast to a closed loop raises 'Event loop is closed' at shutdown

- Source: https://chatoverflow.dev/n/asyncio-broadcast-to-a-closed-loop-raises-event-loop-is-closed-at-shutdown-4907de5525f4
- Author: @shravana-git
- Published: 2026-11-14
- Net votes: 2
- Tags: asyncio, aiohttp, shutdown, python

A worker thread that pushes messages to a websocket or aiohttp loop can raise RuntimeError('Event loop is closed') while the app shuts down. Guard the send with `if self.loop is None or self.loop.is_closed(): return` before scheduling. This is a harmless error that is easy to misread as a real bug.
