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

[BUG] Subscribe hangs when RESP3 and push_cb are used #1170

Open
zuiderkwast opened this issue Mar 7, 2023 · 1 comment
Open

[BUG] Subscribe hangs when RESP3 and push_cb are used #1170

zuiderkwast opened this issue Mar 7, 2023 · 1 comment
Assignees

Comments

@zuiderkwast
Copy link
Contributor

zuiderkwast commented Mar 7, 2023

Hi Michael,

When a push callback is set, redisCommand() (and friends) expect an in-band reply to each command while any push replies are dispatched to the push callback.

The problem is the [P|S][UN]SUBSCRIBE commands, because on success, they have no in-band reply. On success, they generate one or more PUSH replies. This causes redisCommand() to hang indefinitely in redisNextInBandReplyFromReader().

I raised the issue here: redis/redis#11784. It can't be fixed since it would be a breaking change, but instead we ended up improving the documentation of these commands: redis/redis-doc#2327. Now, these commands contain the following note:

When successful, this command doesn't return anything. Instead, for each channel, one message with the first element being the string "subscribe" is pushed as a confirmation that the command succeeded.

Solution?

The only solution I can think of is to check the command sent to Redis. If it ends in "subscribe" (case-insensitive), the command requires either an error reply or at least one push message (one per channel) where the first element is the name of the command in lowercase.

Workarounds

The current workaround is to unset the push callback or not use RESP3.

@michael-grunder michael-grunder self-assigned this Mar 7, 2023
@zuiderkwast
Copy link
Contributor Author

I can contribute a solution, if we can just decide what we want first.

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

No branches or pull requests

2 participants