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

Fix incorrect attribute reuse in redis.connection.CacheProxyConnection #3456

Merged
merged 2 commits into from
Dec 30, 2024

Conversation

zs-neo
Copy link
Contributor

@zs-neo zs-neo commented Dec 12, 2024

Pull Request check-list

Please make sure to review and check all of these items:

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?
  • Was the change added to CHANGES file?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

Attemp to adress #3453

CacheProxyConnection adds caching capabilities to the send_command and read_response methods, but does not clear the _current_command_cache_key attribute. Pipeline and ClusterPipeline use send_packed_command to send requests, which may cause the wrong _current_command_cache_key to be reused during read_response.

@vladvildanov vladvildanov added the bug Bug label Dec 16, 2024
@vladvildanov
Copy link
Collaborator

@zs-neo Thanks for your contribution! Will mark this as a bug and will be included into next patch release

@vladvildanov
Copy link
Collaborator

@zs-neo Few unit tests are still failing

@zs-neo zs-neo force-pushed the bugfix/fix_cache_unexpect_reuse branch from 632fccc to 1423037 Compare December 16, 2024 11:27
@zs-neo zs-neo force-pushed the bugfix/fix_cache_unexpect_reuse branch from c99564d to 25521e4 Compare December 16, 2024 12:21
@zs-neo
Copy link
Contributor Author

zs-neo commented Dec 16, 2024

@vladvildanov Thanks to the useful comments in CacheProxyConnection, which helped me understand the relevant logic. I tried to fix the remaining problems, please take a look at this PR again, any suggestions are welcome.

@vladvildanov
Copy link
Collaborator

@zs-neo Thank you for your input! Let's finish it up and I will include it into next 5.3 GA

@zs-neo
Copy link
Contributor Author

zs-neo commented Dec 24, 2024

tests.test_auth.test_token_manager.TestTokenManager.test_async_success_token_renewal failed, I'll check again.

2024-12-23T12:43:09.9515473Z >       assert len(tokens) == tokens_refreshed
2024-12-23T12:43:09.9516084Z E       assert 3 == 2
2024-12-23T12:43:09.9517386Z E        +  where 3 = len([<redis.auth.token.SimpleToken object at 0x0000000009d708e0>, <redis.auth.token.SimpleToken object at 0x0000000009d70918>, <redis.auth.token.SimpleToken object at 0x0000000009d70950>])

@zs-neo zs-neo force-pushed the bugfix/fix_cache_unexpect_reuse branch from f0721bc to 5b1d4c1 Compare December 24, 2024 08:52
@vladvildanov
Copy link
Collaborator

@zs-neo It's a flacky test, I'll fix and you could rebase a branch

@zs-neo
Copy link
Contributor Author

zs-neo commented Dec 26, 2024

@zs-neo It's a flacky test, I'll fix and you could rebase a branch

Thanks a lot, I tried to fix it but I'm not too familiar with TokenManager, it would be great if you could fix it.

@vladvildanov vladvildanov merged commit e8e6d99 into redis:master Dec 30, 2024
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants