redis-py icon indicating copy to clipboard operation
redis-py copied to clipboard

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

Open Hamza-Lachi opened this issue 4 years ago • 15 comments

hi I had ubuntu 16.0.4 but when I see logs in my gunicorn

I'm getting this

Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]: Process Process-1:119:
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]: Traceback (most recent call last):
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:   File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:     self.run()
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:   File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:     self._target(*self._args, **self._kwargs)
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:   File "/home/emailv-completed/validator/views.py", line 1372, in ch
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:     for r in res1.collect():
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:   File "/home/emailv-completed/env/lib/python3.7/site-packages/celery/result.py", line 289, in collect
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:     yield R, R.get(**kwargs)
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:   File "/home/emailv-completed/env/lib/python3.7/site-packages/celery/result.py", line 228, in get
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:     on_message=on_message,
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:   File "/home/emailv-completed/env/lib/python3.7/site-packages/celery/backends/asynchronous.py", line 200, in wait_for_pending
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:     for _ in self._wait_for_pending(result, **kwargs):
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:   File "/home/emailv-completed/env/lib/python3.7/site-packages/celery/backends/asynchronous.py", line 268, in _wait_for_pending
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:     on_interval=on_interval):
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:   File "/home/emailv-completed/env/lib/python3.7/site-packages/celery/backends/asynchronous.py", line 55, in drain_events_until
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:     yield self.wait_for(p, wait, timeout=interval)
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:   File "/home/emailv-completed/env/lib/python3.7/site-packages/celery/backends/asynchronous.py", line 64, in wait_for
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:     wait(timeout=timeout)
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:   File "/home/emailv-completed/env/lib/python3.7/site-packages/celery/backends/redis.py", line 161, in drain_events
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:     message = self._pubsub.get_message(timeout=timeout)
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:   File "/home/emailv-completed/env/lib/python3.7/site-packages/redis/client.py", line 3135, in get_message
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:     response = self.parse_response(block=False, timeout=timeout)
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:   File "/home/emailv-completed/env/lib/python3.7/site-packages/redis/client.py", line 3036, in parse_response
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:     return self._execute(connection, connection.read_response)
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:   File "/home/emailv-completed/env/lib/python3.7/site-packages/redis/client.py", line 3013, in _execute
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:     return command(*args)
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:   File "/home/emailv-completed/env/lib/python3.7/site-packages/redis/connection.py", line 642, in read_response
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]:     raise response
Jun 14 04:17:01 hamza2.pawnhost.com gunicorn[24450]: redis.exceptions.ResponseError: wrong number of arguments for 'subscribe' command

How can I fix this error

I'm using Django celery and Redis

Version: redis==3.2.1,celery==4.4.2,

Platform: python3.7 | ubuntu 16.04

Hamza-Lachi avatar Jun 14 '20 08:06 Hamza-Lachi

Try upgrade: celery==4.4.5

NullYing avatar Jun 19 '20 03:06 NullYing

I have the latest celery==4.4.5 and redis==3.5.3 versions and I still encounter this error for Ubuntu 18.04 WSL. I'm using the gevent pool for celery if it matters.

silviuum avatar Jun 21 '20 13:06 silviuum

open ignore_result options

NullYing avatar Jun 21 '20 14:06 NullYing

There's not enough information for me to reproduce the error that you're seeing. If you can put together a sample app that consistently reproduces the problem then we can likely figure out what's going on. However I strongly suspect that this is an error in how Celery (or another lib) might be using redis-py rather than a bug within redis-py itself.

andymccurdy avatar Jul 23 '20 00:07 andymccurdy

@Hamza-Lachi @silviuum If either of you can provide an example that reproduces this issue I can take a look and try to figure out what's going on. Currently I don't have enough info to diagnose where the problem is.

andymccurdy avatar Aug 01 '20 22:08 andymccurdy

FWIW, I'm also seeing this with Celery 5.0.0 and Redis for Python 3.5.3.

Unfortunately it's not easy to create a simple app to reproduce, because I'd estimate it happens only once in a while. I've tried it with something as simple as this:

@celery.task()
def add_together(a, b):
    return a + b

def check_working():
    result = tasks.add_together.delay(3, 7).wait()

I put that check_working in a production health check. It works fine for days and then seemingly at random, I'll get this error, only to have the next call work fine.

mikeauthramp avatar Oct 02 '20 13:10 mikeauthramp

@mikeauthramp Is you app running in a multithreaded environment? This seems like a race condition to me. Specifically, I'm wondering if this error is another manifestation of celery/celery#6335.

andymccurdy avatar Oct 02 '20 18:10 andymccurdy

@andymccurdy It is a multi-threaded environment.

mikeauthramp avatar Oct 03 '20 00:10 mikeauthramp

I am also seeing the same issue on celery 5.0. It's quite hard to reproduce and happens once every 24h for us.

Sewci0 avatar Oct 28 '20 16:10 Sewci0

Still pretty confident this is a Celery/Kombu issue, specifically celery/celery#6335.

andymccurdy avatar Oct 29 '20 22:10 andymccurdy

this problem exists in scene that django==3.1.5 with celery==5.1.0; I started django with single-thread, but it sill exists,

lrtxpra avatar May 26 '21 14:05 lrtxpra

I have resolved my problem, first , my problem is kind of this issue, it reports 'ping' command arguments error, I suspect that python-redis package version is not matched, so I changed many version, but same problem happened; At last, I check redis version, Oh, too old, 2.x.x, then I use 5.0+ verison to test, it works well. The issue is an API compatibility problem, between old redis and newer python-redis

lrtxpra avatar May 26 '21 16:05 lrtxpra

I have the ‘ redis.exceptions.ResponseError: wrong number of arguments for 'subscribe' command’ issue with: Azure for cache Redis server 6.14 Celery 5.1.2 Redis-py 3.5.3

so the issue is not sorted Any news on what needs to be done?

Tomasz-Kluczkowski avatar Aug 24 '21 21:08 Tomasz-Kluczkowski

Same for redis in google cloud memorystore. redis-py 3.5.3, celery 5.1.2.

ResponseError: wrong number of arguments for 'subscribe' command
 File "redis/client.py", line 3617, in get_message
    response = self.parse_response(block=False, timeout=timeout)
  File "redis/client.py", line 3505, in parse_response
    response = self._execute(conn, conn.read_response)
  File "redis/client.py", line 3479, in _execute
    return command(*args, **kwargs)
  File "redis/connection.py", line 756, in read_response
    raise response

I would think that celery is probably the one sending the wrong arguments here but I don't think its https://github.com/celery/celery/issues/6335 as I don't have any sort of asynchronous code running.

daviskirk avatar Sep 27 '21 13:09 daviskirk

This issue is marked stale. It will be closed in 30 days if it is not updated.

github-actions[bot] avatar Sep 28 '22 00:09 github-actions[bot]