Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Event loop is closed raised when consumers exit #30

Open
tevariou opened this issue Apr 9, 2024 · 0 comments
Open

RuntimeError: Event loop is closed raised when consumers exit #30

tevariou opened this issue Apr 9, 2024 · 0 comments

Comments

@tevariou
Copy link

tevariou commented Apr 9, 2024

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/venv/lib/python3.10/site-packages/channels/routing.py", line 62, in __call__
    return await application(scope, receive, send)
  File "/srv/venv/lib/python3.10/site-packages/channels/security/websocket.py", line 37, in __call__
    return await self.application(scope, receive, send)
  File "/srv/venv/lib/python3.10/site-packages/channels/sessions.py", line 47, in __call__
    return await self.inner(dict(scope, cookies=cookies), receive, send)
  File "/srv/venv/lib/python3.10/site-packages/channels/sessions.py", line 263, in __call__
    return await self.inner(wrapper.scope, receive, wrapper.send)
  File "/srv/venv/lib/python3.10/site-packages/channels/auth.py", line 185, in __call__
    return await super().__call__(scope, receive, send)
  File "/srv/venv/lib/python3.10/site-packages/channels/middleware.py", line 24, in __call__
    return await self.inner(scope, receive, send)
  File "/srv/api/./common/asgi.py", line 54, in __call__
    return await app(
  File "/srv/venv/lib/python3.10/site-packages/channels/consumer.py", line 94, in app
    return await consumer(scope, receive, send)
  File "/srv/venv/lib/python3.10/site-packages/channels/consumer.py", line 58, in __call__
    await await_many_dispatch(
  File "/srv/venv/lib/python3.10/site-packages/channels/utils.py", line 57, in await_many_dispatch
    await task
  File "/srv/venv/lib/python3.10/site-packages/channels_postgres/core.py", line 174, in receive
    return await self._get_message_from_channel(channel)
  File "/srv/venv/lib/python3.10/site-packages/channels_postgres/core.py", line 135, in _get_message_from_channel
    with await pool as conn:
  File "/srv/venv/lib/python3.10/site-packages/aiopg/pool.py", line 92, in __exit__
    self._pool.release(self._conn)
  File "/srv/venv/lib/python3.10/site-packages/aiopg/pool.py", line 403, in release
    return asyncio.ensure_future(self._wakeup(), loop=self._loop)
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 615, in ensure_future
    return _ensure_future(coro_or_future, loop=loop)
  File "/usr/local/lib/python3.10/asyncio/tasks.py", line 636, in _ensure_future
    return loop.create_task(coro_or_future)
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 436, in create_task
    self._check_closed()
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 515, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

Django==4.2.7
channels-postgres==1.0.4
channels[daphne]==4.0.0
djangochannelsrestframework==1.2.0

When the websocket connection is closed, this error is raised by asyncio. It looks similar to this django/channels_redis#347

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant