You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem when we use channels v3, after some time in production, connection to establish websockets start to work more and more slowly, sometimes it take 1-3 seconds to accept websockets connection and with more time on prod time increases to 170 sec and more, and at the end nginx kill connections (in our setup it`s 300 sec) and you see 502 timeouts.
when we use --limit-max-requests=1000 and --proxy-headers we see errors [Exception in ASGI application],
but after we remove --limit-max-requests=1000 and --proxy-headers all works as expected (only in channels v3 in v4 nothing is working).
Django==4.0.6
daphne==3.0.2
asgiref==3.5.2
channels==3.0.5
channels-redis==3.3.0
websockets==10.4
uvicorn==0.19.0
uvloop==0.17.0
=========================
| ERROR: Exception in ASGI application
| Traceback (most recent call last):
| File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 230, in run_asgi
| result = await self.app(self.scope, self.asgi_receive, self.asgi_send)
| File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
| return await self.app(scope, receive, send)
| File "/usr/local/lib/python3.10/site-packages/channels/routing.py", line 71, in __call__
| return await application(scope, receive, send)
| File "/usr/local/lib/python3.10/site-packages/channels/routing.py", line 150, in __call__
| return await application(
| File "/usr/local/lib/python3.10/site-packages/channels/consumer.py", line 94, in app
| return await consumer(scope, receive, send)
| File "/usr/local/lib/python3.10/site-packages/channels/consumer.py", line 58, in __call__
| await await_many_dispatch(
| File "/usr/local/lib/python3.10/site-packages/channels/utils.py", line 58, in await_many_dispatch
| await task
| TypeError: An asyncio.Future, a coroutine or an awaitable is required
=========================
## uvicorn
uvicorn --host=0.0.0.0 --port=8002 --workers=4 --loop=uvloop --ws=websockets --limit-max-requests=1000 --proxy-headers --log-level=debug core.asgi:application
# simple test class that produce this error
```python
class TestWebSocket(AsyncJsonWebsocketConsumer):
async def connect(self):
try:
await self.create_channel()
await self.accept()
except Exception as exc:
logger.exception(exc)
await self.close()
@database_sync_to_async
def create_channel(self):
# some logic with database.
return
Django==4.1.3
daphne==4.0.0
asgiref==3.5.2
channels==4.0.0
channels-redis==4.0.0
websockets==10.4
uvicorn==0.20.0
uvloop==0.17.0
=========================
| ERROR: Exception in ASGI application
| Traceback (most recent call last):
| File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 230, in run_asgi
| result = await self.app(self.scope, self.asgi_receive, self.asgi_send)
| File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
| return await self.app(scope, receive, send)
| File "/usr/local/lib/python3.10/site-packages/channels/routing.py", line 71, in __call__
| return await application(scope, receive, send)
| File "/usr/local/lib/python3.10/site-packages/channels/routing.py", line 150, in __call__
| return await application(
| File "/usr/local/lib/python3.10/site-packages/channels/consumer.py", line 94, in app
| return await consumer(scope, receive, send)
| File "/usr/local/lib/python3.10/site-packages/channels/consumer.py", line 58, in __call__
| await await_many_dispatch(
| File "/usr/local/lib/python3.10/site-packages/channels/utils.py", line 58, in await_many_dispatch
| await task
| AttributeError: 'list' object has no attribute 'decode'
=========================
uvicorn --host=0.0.0.0 --port=8002 --workers=4 --loop=uvloop --ws=websockets --limit-max-requests=1000 --proxy-headers --log-level=debug core.asgi:application
The text was updated successfully, but these errors were encountered:
Problem was in CHANNEL_LAYERS config, for some reason old version 3 works with list setup example: "hosts": [["127.0.0.1", 6379]],
and migrating to v4 start raise "AttributeError: 'list' object has no attribute 'decode'".
it is very difficult to find and identify such a small mistake.
Problem when we use channels v3, after some time in production, connection to establish websockets start to work more and more slowly, sometimes it take 1-3 seconds to accept websockets connection and with more time on prod time increases to 170 sec and more, and at the end nginx kill connections (in our setup it`s 300 sec) and you see 502 timeouts.
when we use --limit-max-requests=1000 and --proxy-headers we see errors [Exception in ASGI application],
but after we remove --limit-max-requests=1000 and --proxy-headers all works as expected (only in channels v3 in v4 nothing is working).
The text was updated successfully, but these errors were encountered: