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 handling of CancelledError by async client #2607

Closed
wants to merge 1 commit into from

Conversation

jajce
Copy link

@jajce jajce commented Mar 9, 2023

Pull Request check-list

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

  • Does $ tox pass with this change (including linting)?
  • 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

This PR is supposed to fix the issue #2593 .
The problem occurs when invoking cancel() on a task which was executing any redis command. Invoking cancel() resulted in interruption of StreamReader readline() method by the CancelledError. When it happened it resulted in not reading the response from StreamReader after command execution. It caused all future responses to be mixed up between commands.

For example if we canceled a ping() command and executed exists('foo') command afterwards StreamReader reads previously not read b"+PONG\r\n" instead of b":0\r\n" which results in error when trying to parse raw data and cast it to the correct type. (This example is implemented as a working test)

@codecov-commenter
Copy link

codecov-commenter commented Mar 10, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.03 ⚠️

Comparison is base (6c708c2) 92.31% compared to head (3390dfc) 92.28%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2607      +/-   ##
==========================================
- Coverage   92.31%   92.28%   -0.03%     
==========================================
  Files         115      115              
  Lines       29744    29772      +28     
==========================================
+ Hits        27459    27476      +17     
- Misses       2285     2296      +11     
Impacted Files Coverage Δ
redis/asyncio/client.py 93.31% <100.00%> (+0.03%) ⬆️
tests/test_asyncio/test_connection.py 98.35% <100.00%> (+0.26%) ⬆️

... and 4 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@dvora-h
Copy link
Collaborator

dvora-h commented Jul 16, 2023

#2593 already fixed in #2695

@dvora-h dvora-h closed this Jul 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants