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

Prevent from subscribing to empty channels #7040

Merged
merged 2 commits into from
Nov 4, 2021
Merged

Conversation

Androidown
Copy link
Contributor

Note: Before submitting this pull request, please review our contributing
guidelines
.

Description

If an error occurs while calling self._pubsub.get_message, method _reconnect_pubsub will be called.
after the following loop is completed:

  for meta in metas:
      self.on_state_change(self._decode_result(meta), None)

all subscribed tasks might be discarded and the set self.subscribed_to will be empty. Thus a call to self._pubsub.subscribe(*self.subscribed_to) will leads the following error:

redis.exceptions.ResponseError: wrong number of arguments for 'subscribe' command

Maybe related issues:
redis/redis-py#1351
#6993

@Androidown Androidown changed the title Prevent from subscribing to emtpy channels Prevent from subscribing to empty channels Nov 3, 2021
Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like the patch, however can you atleast provide minimal unit test?

@auvipy auvipy added this to the 5.2 milestone Nov 3, 2021
@auvipy auvipy linked an issue Nov 3, 2021 that may be closed by this pull request
18 tasks
@lgtm-com
Copy link

lgtm-com bot commented Nov 3, 2021

This pull request introduces 2 alerts when merging ad5dab8 into 5d68d78 - view on LGTM.com

new alerts:

  • 2 for Wrong name for an argument in a call

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey, thanks for the tests! this pr #7041 recently stabilizes the CI. could you please pull from master and check this still passes the CI?

@auvipy auvipy merged commit e5d9980 into celery:master Nov 4, 2021
@auvipy
Copy link
Member

auvipy commented Nov 4, 2021

=========================== short test summary info ============================
FAILED t/unit/backends/test_mongodb.py::test_MongoBackend::test_init_mongodb_dns_seedlist
= 1 failed, 2599 passed, 17 skipped, 3 xfailed, 50 warnings in 103.53s (0:01:43) =
ERROR: InvocationError for command /home/runner/work/celery/celery/.tox/3.10-unit/bin/pytest --maxfail=10 -v --cov=celery --cov-report=xml --cov-report term (exited with code 1)
3.10-unit finish: run-test after 106.71 seconds
3.10-unit start: run-test-post

@auvipy
Copy link
Member

auvipy commented Nov 4, 2021

but e5d9980 is green!

@hexvolt
Copy link

hexvolt commented Feb 15, 2022

Still an issue in Sentry 5.2.3 (Python 3.9, redis-server 5.0.4, redis-py 3.5.3)
ResponseError: wrong number of arguments for 'subscribe' command

@auvipy
Copy link
Member

auvipy commented Feb 16, 2022

Still an issue in Sentry 5.2.3 (Python 3.9, redis-server 5.0.4, redis-py 3.5.3) ResponseError: wrong number of arguments for 'subscribe' command

can you try #7232 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redis ResponseError: Wrong number of arguments for 'subscribe' command
3 participants