0

I have redis 5.4. and I am gettign this error: aioredis.errors.ReplyError: ERR unknown command 'BZPOPMIN' I am following the tutorial on the django-channels website. This is the consumer code:

class ChatConsumer(WebsocketConsumer):
    def connect(self):
        self.room_name = self.scope['url_route']['kwargs']['room_name']
        self.room_group_name = 'chat_%s' % self.room_name

        # Join room group
        async_to_sync(self.channel_layer.group_add)(
            self.room_group_name,
            self.channel_name
        )

        self.accept()

    def disconnect(self, close_code):
        # Leave room group
        async_to_sync(self.channel_layer.group_discard)(
            self.room_group_name,
            self.channel_name
        )

    # Receive message from WebSocket
    def receive(self, text_data):
        text_data_json = json.loads(text_data)
        message = text_data_json['message']

        # Send message to room group
        async_to_sync(self.channel_layer.group_send)(
            self.room_group_name,
            {
                'type': 'chat_message',
                'message': message
            }
        )

    # Receive message from room group
    def chat_message(self, event):
        message = event['message']

        # Send message to WebSocket
        self.send(text_data=json.dumps({
            'message': message
        }))

I run my server using python manage.py runserver 0.0.0.0:8080 -- noreload maybe it has to do something with that, I open the page on the 5656 port and it is hosted on 8080 as I am using vagrant and those are the set ports in the VagrantFile.

EDIT Not sure why but if I check the version of redis-server on pip freeze I get (.venv) vagrant@vagrant:/vagrant/ChatApp$ redis-server --version Redis server v=4.0.9 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=9435c3c2879311f3, but I am not sure why that is and how I can fix that.

Output of pip feeeze:

aioredis==1.3.1
asgiref==3.2.10
async-timeout==3.0.1
attrs==20.1.0
autobahn==20.7.1
Automat==20.2.0
certifi==2020.6.20
cffi==1.14.2
channels==2.4.0
channels-redis==3.0.1
chardet==3.0.4
constantly==15.1.0
cryptography==3.0
daphne==2.5.0
Django==3.1
django-channels==0.7.0
hiredis==1.1.0
hyperlink==20.0.1
idna==2.10
incremental==17.5.0
msgpack==1.0.0
oauthlib==3.1.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
PyHamcrest==2.0.2
pyOpenSSL==19.1.0
pytz==2020.1
redis-server==5.0.7
requests==2.24.0
requests-oauthlib==1.3.0
service-identity==18.1.0
six==1.15.0
sqlparse==0.3.1
Twisted==20.3.0
txaio==20.4.1
urllib3==1.25.10
zope.interface==5.1.0
MareksNo
  • 140
  • 2
  • 12
  • Please check this answer https://stackoverflow.com/a/63291700/2188922 – Ersoy Aug 26 '20 at 13:25
  • I have redis-server 5.0.7. Installed as you can see in the pip freeze, but from the redis-server --version command you can see that there it shows a different older version, and I am not sure how I can make it use a newer version. – MareksNo Aug 26 '20 at 14:01
  • I think you need to remove the older version to see make it work with v5 but you may need to google it for it(not familiar with that stuff) – Ersoy Aug 26 '20 at 19:00
  • Not sure how, cpuldnt find 4.0.9. In the file system, but will try – MareksNo Aug 27 '20 at 05:06
  • The redis server is not a pip package but a system package (RPM, DEB, etc) so you shouldn't be looking for the version on pip. I am not sure what the `redis-server` packge you have on your pip is but it is not the server needed. So you should ignore that and update the system redis server to version 5 – Ken4scholars Aug 28 '20 at 01:30
  • Will try to do that – MareksNo Aug 28 '20 at 04:32
  • you can update your Redis from here https://github.com/tporadowski/redis/releases – Maninder Singh Dec 03 '20 at 12:41

1 Answers1

1

I am not sure but the problem may be related to channels-Redis, may be it is not compatible with the version of channels, try downgrading or updating channels-Redis

Anshu Pal
  • 39
  • 3