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

Connection Error("Invalid Database") raised if the db and decode_responses=True parameters is specified #46

Closed
pribit opened this issue Apr 21, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@pribit
Copy link

pribit commented Apr 21, 2022

Connection Error("Invalid Database") raised if the db and decode_responses=True parameters is specified.

connection.py

    if self.db:
        await self.send_command(b"SELECT", self.db)

        if await self.read_response() != b"OK":
            raise ConnectionError("Invalid Database")

But if we add the decode=False parameter or compare it with "OK", the connection will be successful.
await self.read_response() actually return 'OK'.

I initialize ConnectionPool with the parameters decode_responses=True, encoding='utf-8' and db=1. Then I get a connection using the get_connection method and try to connect. If I remove decode_responses, the connection will also be successful.

I'm using python 3.10.2 with coredis==3.4.1
redis_version:5.0.4

alisaifee added a commit that referenced this issue Apr 21, 2022
If a db is selected upon connect, read the response back
without decoding.

Addresses #46
@alisaifee
Copy link
Owner

alisaifee commented Apr 21, 2022

Thanks for the report and apologies for the regression (looks like this was introduced in 3.2.0).
I'll cut a patch release shortly to address this.

@alisaifee
Copy link
Owner

Fixed in 3.4.2

@pribit
Copy link
Author

pribit commented Apr 22, 2022

Thanks for the quick response. Now everything works!

@alisaifee alisaifee added the bug Something isn't working label Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants