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: Blocking commands respect canceled context #2433

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

armsnyder
Copy link
Contributor

Description

This fixes an issue where blocking commands like XRead and XReadGroup could not be canceled using the provided context. Similarly with *PubSub.Receive.

Fixes #2276
Supersedes #2432

Approach

I looked holistically at places in the code where a connection was being used without inspecting the context and applied the same basic pattern. Once a timeout is reached, the recommendation is to close the connection. Note that the change to *PubSub.ReceiveTimeout does not explicitly close the connection since that is already handled by the subsequent *PubSub.releaseConnWithLock.

Note that with this change, the ContextTimeoutEnabled client option is redundant. Can we deprecate it?

Testing

The new tests that I added all failed without this change. Note that I did not add new tests for the processPipeline and processTxPipeline changes, since pipelining blocking commands does not make sense. However, if you can think of a good test case I will be happy to add it.

@chayim
Copy link
Contributor

chayim commented Feb 13, 2023

@monkey92t looks reasonable WDYT?

@wk8
Copy link

wk8 commented Apr 27, 2023

Just hit this, could this please get reviewed & merged? Looks reasonable no?

@vmihailenco vmihailenco added the wait Can’t be processed temporarily for other reasons label Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug wait Can’t be processed temporarily for other reasons
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blocking XGroupCreateMkStream does not interrupt on context cancellation
4 participants