我的芹菜工人在使用rabbitMQ工作了几分钟后,一直给我一个套接字错误——见下文。我想知道问题的主要原因是什么?我以为它可能是防火墙。但是,禁用防火墙并没有解决问题。我正在一台Windows 10机器上工作。
C:Usersuser_DesktopAida>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:usersuser_appdatalocalprogramspythonpython37-32libsite-packageseventlethubsselects.py", line 55, in wait
listeners.get(fileno, noop).cb(fileno)
[2018-07-13 12:30:04,276: WARNING/MainProcess] File "c:usersuser_appdatalocalprogramspythonpython37-32libsite-packagesceleryworkerpidbox.py", line 120, in loop
connection.drain_events(timeout=1.0)
[2018-07-13 12:30:04,277: WARNING/MainProcess] File "c:usersuser_appdatalocalprogramspythonpython37-32libsite-packageskombuconnection.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:usersuser_appdatalocalprogramspythonpython37-32libsite-packageskombutransportpyamqp.py", line 103, in drain_events
return connection.drain_events(**kwargs)
[2018-07-13 12:30:04,279: WARNING/MainProcess] File "c:usersuser_appdatalocalprogramspythonpython37-32libsite-packagesamqpconnection.py", line 491, in drain_events
while not self.blocking_read(timeout):
[2018-07-13 12:30:04,281: WARNING/MainProcess] File "c:usersuser_appdatalocalprogramspythonpython37-32libsite-packagesamqpconnection.py", line 496, in blocking_read
frame = self.transport.read_frame()
[2018-07-13 12:30:04,285: WARNING/MainProcess] File "c:usersuser_appdatalocalprogramspythonpython37-32libsite-packagesamqptransport.py", line 243, in read_frame
frame_header = read(7, True)
[2018-07-13 12:30:04,286: WARNING/MainProcess] File "c:usersuser_appdatalocalprogramspythonpython37-32libsite-packagesamqptransport.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
我不是windows用户,但我会给你一些提示。
(1( -检查你的rabbitmq-配置是否与你的连接字符串匹配(特别是在linux中,我可以将rabbitmq配置为只在特定接口上侦听,这样它就不会接受环回接口上的连接(;我要检查的配置选项是NODE_IP_ADDRESS
(2( -假设你100%确定你的rabbitmq正在运行,我会检查NODENAME
是否与你的实际系统配置匹配(即检查主机名的正确性(
(3( -最明显但仍然值得检查的是,你的rabbitmq-用户是否正确(我看到你有guest
用户,你自己创建了这个用户吗?你给它特定vhost的权限了吗?(
(4( -如果你的连接字符串是正确的,这就引出了另一个显而易见的问题。我的连接字符串看起来像这个BROKER_URL = 'amqp://my_user:very_secret_password@localhost:5672/my_vhost_name
(在你的日志中,你似乎没有将连接字符串配置为使用vhost(
我在使用--without heartbeat选项运行芹菜工作者时也遇到了这个错误。删除--without heartbeat选项后,这个选项就消失了。
我认为,要想正确地使——在没有心跳的情况下,我们需要更改代理的心跳设置,以阻止它断开不发送心跳的消费者的连接。不过我还没试过。