我的与RabbitMQ一起工作的芹菜工人在工作了几分钟后,一直给我一个套接字错误-见下文。我想知道问题的主要原因是什么?我以为可能是防火墙。但是,禁用防火墙并不能解决问题。 我正在Windows 10计算机上工作。
C:\Users\user_\Desktop\Aida>celery -A tasks worker -l info -P eventlet
-------------- celery@user-RazerBlade v4.2.0 (windowlicker)
---- **** -----
--- * *** * -- Windows-10-10.0.17134-SP0 2018-07-13 12:27:03
-- * - **** ---
- ** ---------- [config]
- ** ---------- .> app: tasks:0x4b95370
- ** ---------- .> transport: amqp://guest:**@localhost:5672//
- ** ---------- .> results: redis://
- *** --- * --- .> concurrency: 4 (eventlet)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** -----
-------------- [queues]
.> queueA exchange=(direct) key=tasks.task_1
.> queueB exchange=(direct) key=tasks.task_2
.> queueC exchange=(direct) key=tasks.task_3
.> queueD exchange=(direct) key=tasks.task_4
[tasks]
. tasks.task_1
. tasks.task_2
. tasks.task_3
. tasks.task_4
[2018-07-13 12:27:03,119: INFO/MainProcess] Connected to amqp://guest:**@127.0.0.1:5672//
[2018-07-13 12:27:03,133: INFO/MainProcess] mingle: searching for neighbors
[2018-07-13 12:27:04,166: INFO/MainProcess] mingle: all alone
[2018-07-13 12:27:04,212: INFO/MainProcess] pidbox: Connected to amqp://guest:**@127.0.0.1:5672//.
[2018-07-13 12:27:04,217: INFO/MainProcess] celery@user-RazerBlade ready.
[2018-07-13 12:30:04,270: WARNING/MainProcess] Traceback (most recent call last):
[2018-07-13 12:30:04,271: WARNING/MainProcess] File "c:\users\user_\appdata\local\programs\python\python37-32\lib\site-packages\eventlet\hubs\selects.py", line 55, in wait
listeners.get(fileno, noop).cb(fileno)
[2018-07-13 12:30:04,276: WARNING/MainProcess] File "c:\users\user_\appdata\local\programs\python\python37-32\lib\site-packages\celery\worker\pidbox.py", line 120, in loop
connection.drain_events(timeout=1.0)
[2018-07-13 12:30:04,277: WARNING/MainProcess] File "c:\users\user_\appdata\local\programs\python\python37-32\lib\site-packages\kombu\connection.py", line 301, in drain_events
return self.transport.drain_events(self.connection, **kwargs)
[2018-07-13 12:30:04,278: WARNING/MainProcess] File "c:\users\user_\appdata\local\programs\python\python37-32\lib\site-packages\kombu\transport\pyamqp.py", line 103, in drain_events
return connection.drain_events(**kwargs)
[2018-07-13 12:30:04,279: WARNING/MainProcess] File "c:\users\user_\appdata\local\programs\python\python37-32\lib\site-packages\amqp\connection.py", line 491, in drain_events
while not self.blocking_read(timeout):
[2018-07-13 12:30:04,281: WARNING/MainProcess] File "c:\users\user_\appdata\local\programs\python\python37-32\lib\site-packages\amqp\connection.py", line 496, in blocking_read
frame = self.transport.read_frame()
[2018-07-13 12:30:04,285: WARNING/MainProcess] File "c:\users\user_\appdata\local\programs\python\python37-32\lib\site-packages\amqp\transport.py", line 243, in read_frame
frame_header = read(7, True)
[2018-07-13 12:30:04,286: WARNING/MainProcess] File "c:\users\user_\appdata\local\programs\python\python37-32\lib\site-packages\amqp\transport.py", line 426, in _read
raise IOError('Socket closed')
[2018-07-13 12:30:04,287: WARNING/MainProcess] OSError: Socket closed
[2018-07-13 12:30:04,288: WARNING/MainProcess] Removing descriptor: 756
答案 0 :(得分:1)
我不是Windows用户,但我会尝试给您一些提示。
(1)-检查您的Rabbitmq配置是否与您的连接字符串匹配(特别是在linux中,我可以将Rabbitmq配置为仅侦听特定的接口,以便它不接受环回接口上的连接);我要检查的配置选项是NODE_IP_ADDRESS
(2)-假设您100%确信Rabbitmq正在运行,我将检查NODENAME
是否与您的实际系统配置相匹配(即检查主机名的正确性)
(3)-最明显但仍值得检查的是您的rabbitmq用户是否正确(我看到您有guest
用户,您是自己创建的吗?您是否授予它对特定虚拟主机的权限? )
(4)-这会导致另一个明显的问题,即您的连接字符串是否正确。我的连接字符串看起来像这样BROKER_URL = 'amqp://my_user:very_secret_password@localhost:5672/my_vhost_name
(在您的日志中,似乎没有配置连接字符串以使用vhost)
答案 1 :(得分:0)
我在使用 --without-heartbeat 选项运行 celery workers 时也遇到了这个错误。 删除 --without-heartbeat 选项后,这种情况就消失了。
我认为要正确地使 --without-heartbeat 工作,我们需要更改代理的心跳设置,以阻止它断开不发送心跳的消费者的连接。不过没试过。