1
我有一個應用程序,分發負載的一堆工人。到目前爲止,所有工作人員都在同一臺虛擬機上運行,而且還不需要擴展。 我的問題是,像每3-4天一樣,工作人員崩潰與下面的錯誤消息 - 客戶端和rabbitmq服務器之間沒有接觸1200秒(我猜)。應用程序崩潰後,錯過了太多的心跳
Traceback (most recent call last):
File "/var/www/vhosts/niklas/workers/builder.py", line 170, in <module>
BuildWorker().main()
File "/var/www/vhosts/niklas/lib/worker.py", line 29, in main
self.msgs.ch.start_consuming()
File "/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", line 722, in start_consuming
self.connection.process_data_events()
File "/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", line 93, in process_data_events
self.process_timeouts()
File "/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", line 99, in process_timeouts
self._call_timeout_method(self._timeouts.pop(timeout_id))
File "/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", line 164, in _call_timeout_method
timeout_value['method']()
File "/usr/local/lib/python2.6/dist-packages/pika/heartbeat.py", line 85, in send_and_check
return self._close_connection()
File "/usr/local/lib/python2.6/dist-packages/pika/heartbeat.py", line 106, in _close_connection
HeartbeatChecker._STALE_CONNECTION % duration)
File "/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", line 75, in close
self.process_data_events()
File "/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", line 91, in process_data_events
self._handle_timeout()
File "/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", line 198, in _handle_timeout
self._on_connection_closed(None, True)
File "/usr/local/lib/python2.6/dist-packages/pika/adapters/blocking_connection.py", line 235, in _on_connection_closed
raise exceptions.AMQPConnectionError(*self.closing)
pika.exceptions.AMQPConnectionError: (320, 'Too Many Missed Heartbeats, No reply in 1200 seconds')
我的問題是,什麼可能導致這種情況? 這隻發生在三名工作人員中的大約1人中,其他人工作正常,沒有任何錯誤信息或警告(同一虛擬機上的所有worker和rabbitmq-server)。 我在Python庫pika,start_consuming()中使用標準方法來檢索新的請求。該代碼是太大附加在這裏,並考慮到錯誤消息,它似乎是我的代碼或系統問題。
我使用:
- 的Python 0.9.8鼠兔
- 的RabbitMQ 3.0.0
- 的Debian 6.0
- 所有工人都內屏幕
- VM託管在的Linode,512MB開始內存
太棒了!似乎工作,謝謝! – Niklas9