我将celery
与rabbitmq
一起使用,但我最近收到此错误sock.setsockopt(SOL_TCP, opt, val), [Errno 22] Invalid argument
,
详细地说,
{1: 1, 2: 16396, 3: 0, 4: 60, 5: 10, 6: 9, 7: 0, 8: 30, 9: 0, 10: 81059, 12: 1}
(6, 1, 1)
(6, 2, 16396)
(6, 3, 0)
(6, 4, 60)
(6, 5, 10)
(6, 6, 9)
(6, 7, 0)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/celery/app/task.py", line 535, in apply_async
**options
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/celery/app/base.py", line 737, in send_task
amqp.send_task_message(P, name, message, **options)
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/celery/app/amqp.py", line 558, in send_task_message
**properties
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/kombu/messaging.py", line 181, in publish
exchange_name, declare,
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/kombu/connection.py", line 527, in _ensured
errback and errback(exc, 0)
File "/app/pyenv/versions/2.7.11/lib/python2.7/contextlib.py", line 35, in __exit__
self.gen.throw(type, value, traceback)
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/kombu/connection.py", line 419, in _reraise_as_library_errors
sys.exc_info()[2])
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/kombu/connection.py", line 414, in _reraise_as_library_errors
yield
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/kombu/connection.py", line 515, in _ensured
reraise_as_library_errors=False,
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/kombu/connection.py", line 405, in ensure_connection
callback)
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/kombu/utils/functional.py", line 333, in retry_over_time
return fun(*args, **kwargs)
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/kombu/connection.py", line 261, in connect
return self.connection
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/kombu/connection.py", line 802, in connection
self._connection = self._establish_connection()
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/kombu/connection.py", line 757, in _establish_connection
conn = self.transport.establish_connection()
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/kombu/transport/pyamqp.py", line 130, in establish_connection
conn.connect()
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/amqp/connection.py", line 294, in connect
self.transport.connect()
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/amqp/transport.py", line 122, in connect
self.socket_settings, self.read_timeout, self.write_timeout,
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/amqp/transport.py", line 174, in _init_socket
self._set_socket_options(socket_settings)
File "/app/pyenv/versions/2.7.11/lib/python2.7/site-packages/amqp/transport.py", line 205, in _set_socket_options
self.sock.setsockopt(SOL_TCP, opt, val)
File "/app/pyenv/versions/2.7.11/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
kombu.exceptions.OperationalError: [Errno 22] Invalid argument
(6, 7, 0)
是我print(SOL_TCP, opt, val)
中添加的_set_socket_options
的输出
在提到_socket.pi
之后,我明白了:
6
,SOL_TCP = 6
7
,TCP_SYNCNT = 7
(我认为......)0
,val 我所知道的全部内容,我认为它与系统设置有关,它与其他具有相同代码和包的系统一起使用。但我对TCP_SYNCNT
知之甚少,感谢任何帮助!
BTW,这是我的环境
冻结
amqp==2.1.4
billiard==3.5.0.2
celery==4.0.2
chardet==3.0.4
Django==1.10.3
django-redis==4.8.0
djangorestframework==3.6.3
httplib2==0.10.3
kombu==4.0.2
netifaces==0.10.6
psutil==5.2.2
py==1.4.34
pyasn1==0.2.3
pyftpdlib==1.5.2
pyrabbit==1.1.0
pytest==3.0.6
pytz==2017.2
redis==2.10.5
rsa==3.4.2
six==1.10.0
vine==1.1.3
xlrd==1.0.0
答案 0 :(得分:0)
由集合net.ipv4.tcp_syn_retries = 1
解决,有人将其设置为0
,这可能意味着永远不会在syn
之前发送ESTABLISHED
。