TypeError: can't pickle memoryview objects when running basic add.delay(1,2) test
Asked Answered
O

1

6

Trying to run the most basic test of add.delay(1,2) using celery 4.1.0 with Python 3.6.4 and getting the following error:

[2018-02-27 13:58:50,194: INFO/MainProcess] Received task: exb.tasks.test_tasks.add[52c3fb33-ce00-4165-ad18-15026eca55e9]
[2018-02-27 13:58:50,194: CRITICAL/MainProcess] Unrecoverable error: SystemError(' returned a result with an error set',) Traceback (most recent call last): File "/opt/myapp/lib/python3.6/site-packages/kombu/messaging.py", line 624, in _receive_callback return on_m(message) if on_m else self.receive(decoded, message) File "/opt/myapp/lib/python3.6/site-packages/celery/worker/consumer/consumer.py", line 570, in on_task_received callbacks, File "/opt/myapp/lib/python3.6/site-packages/celery/worker/strategy.py", line 145, in task_message_handler handle(req) File "/opt/myapp/lib/python3.6/site-packages/celery/worker/worker.py", line 221, in _process_task_sem return self._quick_acquire(self._process_task, req) File "/opt/myapp/lib/python3.6/site-packages/kombu/async/semaphore.py", line 62, in acquire callback(*partial_args, **partial_kwargs) File "/opt/myapp/lib/python3.6/site-packages/celery/worker/worker.py", line 226, in _process_task req.execute_using_pool(self.pool) File "/opt/myapp/lib/python3.6/site-packages/celery/worker/request.py", line 531, in execute_using_pool correlation_id=task_id, File "/opt/myapp/lib/python3.6/site-packages/celery/concurrency/base.py", line 155, in apply_async **options) File "/opt/myapp/lib/python3.6/site-packages/billiard/pool.py", line 1486, in apply_async self._quick_put((TASK, (result._job, None, func, args, kwds))) File "/opt/myapp/lib/python3.6/site-packages/celery/concurrency/asynpool.py", line 813, in send_job body = dumps(tup, protocol=protocol) TypeError: can't pickle memoryview objects

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/opt/myapp/lib/python3.6/site-packages/celery/worker/worker.py", line 203, in start self.blueprint.start(self) File "/opt/myapp/lib/python3.6/site-packages/celery/bootsteps.py", line 119, in start step.start(parent) File "/opt/myapp/lib/python3.6/site-packages/celery/bootsteps.py", line 370, in start return self.obj.start() File "/opt/myapp/lib/python3.6/site-packages/celery/worker/consumer/consumer.py", line 320, in start blueprint.start(self) File "/opt/myapp/lib/python3.6/site-packages/celery/bootsteps.py", line 119, in start step.start(parent) File "/opt/myapp/lib/python3.6/site-packages/celery/worker/consumer/consumer.py", line 596, in start c.loop(*c.loop_args()) File "/opt/myapp/lib/python3.6/site-packages/celery/worker/loops.py", line 88, in asynloop next(loop) File "/opt/myapp/lib/python3.6/site-packages/kombu/async/hub.py", line 354, in create_loop cb(*cbargs) File "/opt/myapp/lib/python3.6/site-packages/kombu/transport/base.py", line 236, in on_readable reader(loop) File "/opt/myapp/lib/python3.6/site-packages/kombu/transport/base.py", line 218, in _read drain_events(timeout=0) File "/opt/myapp/lib/python3.6/site-packages/librabbitmq-2.0.0-py3.6-linux-x86_64.egg/librabbitmq/init.py", line 227, in drain_events self._basic_recv(timeout) SystemError: returned a result with an error set

I cannot find any previous evidence of anyone hitting this error. I noticed from the celery site that only python 3.5 is mentioned as supported, is that the issue or is this something I am missing?

Any help would be much appreciated!

UPDATE: Tried with Python 3.5.5 and the problem persists. Tried with Django 4.0.2 and the problem persists.

UPDATE: Uninstalled librabbitmq and the problem stopped. This was seen after migration from Python 2.7.5, Django 1.7.7 to Python 3.6.4, Django 2.0.2.

Odoric answered 27/2, 2018 at 22:22 Comment(1)
I am stuck at the same problem - @Odoric , have you found the solution yet?Buoyant
O
4

After uninstalling librabbitmq, the problem was resolved.

Odoric answered 30/4, 2018 at 7:45 Comment(1)
Thanks @dparkeruk, but then you are not using the more performant librabbitmq as amqp is falling but to the slower pyamqp - docs.celeryproject.org/en/latest/userguide/… -- right? Hope you see what i meanBuoyant

© 2022 - 2024 — McMap. All rights reserved.