Skip to content

ValueError: loop argument must agree with lock with Python 3.8 #289

@MatejMijoski

Description

@MatejMijoski

I'm trying to add Redis as a channel layer to the django-channels implementation but after setting it up, I'm getting the following error: ValueError: loop argument must agree with lock.

Channel Layers config:

CHANNEL_LAYERS = {
    'default': {
        'BACKEND': "channels_redis.core.RedisChannelLayer",
        'CONFIG': { 'hosts': ['redis://:password@url:6380/0' }
    },
}
  • A pip freeze output showing your package versions
    aioredis==1.3.1
    channels==3.0.4
    channels-redis==3.3.1
  • How you're running Channels (runserver? daphne/runworker? Nginx/Apache in front?)
    runserver - ASGI/Channels version 3.0.4 development server

Full Stacktrace:

Traceback (most recent call last):
  File "C:\Users\PC-M\Desktop\api\.venv\lib\site-packages\channels\staticfiles.py", line 44, in __call__
    return await self.application(scope, receive, send)
  File "C:\Users\PC-M\Desktop\api\.venv\lib\site-packages\channels\routing.py", line 71, in __call__
    return await application(scope, receive, send)
  File "C:\Users\PC-M\Desktop\api\app\hq\asgi.py", line 41, in __call__
    return await self.app(scope, receive, send)
  File "C:\Users\PC-M\Desktop\api\.venv\lib\site-packages\channels\routing.py", line 150, in __call__
    return await application(
  File "C:\Users\PC-M\Desktop\api\.venv\lib\site-packages\channels\consumer.py", line 94, in app
    return await consumer(scope, receive, send)
  File "C:\Users\PC-M\Desktop\api\.venv\lib\site-packages\channels\consumer.py", line 58, in __call__
    await await_many_dispatch(
  File "C:\Users\PC-M\Desktop\api\.venv\lib\site-packages\channels\utils.py", line 51, in await_many_dispatch
    await dispatch(result)
  File "C:\Users\PC-M\Desktop\api\.venv\lib\site-packages\channels\consumer.py", line 73, in dispatch
    await handler(message)
  File "C:\Users\PC-M\Desktop\api\.venv\lib\site-packages\channels\generic\websocket.py", line 173, in websocket_connect
    await self.connect()
  File "C:\Users\PC-M\Desktop\api\app\hq\consumers.py", line 35, in connect
    await self.channel_layer.group_add(
  File "C:\Users\PC-M\Desktop\api\.venv\lib\site-packages\channels_redis\core.py", line 646, in group_add
    async with self.connection(self.consistent_hash(group)) as connection:
  File "C:\Users\PC-M\Desktop\api\.venv\lib\site-packages\channels_redis\core.py", line 902, in __aenter__
    self.conn = await self.pool.pop()
  File "C:\Users\PC-M\Desktop\api\.venv\lib\site-packages\channels_redis\core.py", line 93, in pop
    conn = await self.create_conn(loop)
  File "C:\Users\PC-M\Desktop\api\.venv\lib\site-packages\channels_redis\core.py", line 79, in create_conn
    return await aioredis.create_redis_pool(**kwargs)
  File "C:\Users\PC-M\Desktop\api\.venv\lib\site-packages\aioredis\commands\__init__.py", line 188, in create_redis_pool
    pool = await create_pool(address, db=db,
  File "C:\Users\PC-M\Desktop\api\.venv\lib\site-packages\aioredis\pool.py", line 51, in create_pool
    pool = cls(address, db, password, encoding,
  File "C:\Users\PC-M\Desktop\api\.venv\lib\site-packages\aioredis\pool.py", line 95, in __init__
    self._cond = asyncio.Condition(lock=Lock())
  File "C:\Users\PC-M\AppData\Local\Programs\Python\Python310\lib\asyncio\locks.py", line 234, in __init__
    raise ValueError("loop argument must agree with lock")
ValueError: loop argument must agree with lock

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions