Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Celery: consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 92] Protocol not available

I keep getting this error, and I don't know why. I'm using Ubuntu on Windows 10 and celery used to work fine. Then something happened and I keep getting this error. I use celery docs to learn.

Here is the task.py:

from celery import Celery

app = Celery('tasks', broker='pyamqp://guest@localhost//')

@app.task
def add(x, y):
    return x + y

Here the error that I'm getting:

[2017-08-14 17:34:04,436: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 92] Protocol not available.
Trying again in 2.00 seconds...

[2017-08-14 17:34:06,453: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 92] Protocol not available.
Trying again in 4.00 seconds...

[2017-08-14 17:34:10,465: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 92] Protocol not available.
Trying again in 6.00 seconds...

[2017-08-14 17:34:16,480: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: [Errno 92] Protocol not available.
Trying again in 8.00 seconds...

In order to start Celery I type:

celery -A tasks worker --loglevel=info
like image 475
ottomd Avatar asked Aug 14 '17 14:08

ottomd


1 Answers

Did you recently update amqp?

It seems that connecting to a RabbitMQ instance from a Linux subsystem is not possible anymore since versions past 2.1.2 du to socket witchery.

https://github.com/celery/py-amqp/issues/145

I suggest trying other backends that Celery might support, I'm going to try redis. Downgrading to at least RabbitMQ 2.1.2 could possibly solve the problem too.

like image 176
A.Dupont Avatar answered Nov 12 '22 00:11

A.Dupont