channels_redis icon indicating copy to clipboard operation
channels_redis copied to clipboard

Another Reader at end of file error

Open Hyperian428 opened this issue 5 years ago • 0 comments

This seems to be a similar error that I'm seeing other people are having in #158 and #215. It also seem to only happen on deployment because (for heroku) it limits the number of redis connection you can have (20 in my case). If I lower the redis timeout parameter to 30. The first send message command will send message correctly, but after 30 seconds, using send message command will cause the "Reader at end of file error"

This should be reproducible using the chatroom example, deploying it to heroku, and setting redis timeout to something low, like 30 seconds. And then send a chat message, then after 30 seconds, send another chat message.

I don't think channel redis is correctly handling redis connection closing by itself(timeout). since if it the redis connection no longer exists, it should create a new one and send messages through it. Though I don't know enough of the channel_Redis architecture to recommend changes.

ERROR    Exception inside application: Reader at end of file
File "/app/.heroku/python/lib/python3.6/site-packages/channels/consumer.py", line 59, in __call__
[receive, self.channel_receive], self.dispatch
File "/app/.heroku/python/lib/python3.6/site-packages/channels/utils.py", line 51, in await_many_dispatch
await dispatch(result)
File "/app/.heroku/python/lib/python3.6/site-packages/channels/consumer.py", line 73, in dispatch
await handler(message)
File "./myapp/webhook.py", line 133, in http_request
await self.channel_layer.send(userDB.backEndChannelName,{"type": "device.query"})
File "/app/.heroku/python/lib/python3.6/site-packages/channels_redis/core.py", line 296, in send
if await connection.llen(channel_key) >= self.get_capacity(channel):
File "/app/.heroku/python/lib/python3.6/site-packages/aioredis/commands/list.py", line 70, in llen
return self.execute(b'LLEN', key)
File "/app/.heroku/python/lib/python3.6/site-packages/aioredis/commands/__init__.py", line 51, in execute
return self._pool_or_conn.execute(command, *args, **kwargs)
File "/app/.heroku/python/lib/python3.6/site-packages/aioredis/connection.py", line 322, in execute
raise ConnectionClosedError(msg)
Reader at end of file

Hyperian428 avatar Nov 04 '20 04:11 Hyperian428