質問

私が使う:

  • Mongodb 1.6.5
  • ピモンゴ1.9
  • Python 2.6.6

私は3種類のデーモンを持っています。 Webからの最初のロードデータ、2番目のデータを分析して結果を保存し、3番目のグループ結果を保存します。それらはすべてMongodbで働いています。ある時点で、3番目のデーモンはこのような多くの例外をスローします(主にDBに大量のデータがある場合):

Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/gevent-0.13.1-py2.6-linux-x86_64.egg/gevent/greenlet.py", line 405, in run
    result = self._run(*self.args, **self.kwargs)
  File "/data/www/spider/daemon/scripts/mainconverter.py", line 72, in work
    for item in res:
  File "/usr/local/lib/python2.6/dist-packages/pymongo-1.9_-py2.6-linux-x86_64.egg/pymongo/cursor.py", line 601, in next
    if len(self.__data) or self._refresh():
  File "/usr/local/lib/python2.6/dist-packages/pymongo-1.9_-py2.6-linux-x86_64.egg/pymongo/cursor.py", line 564, in _refresh
    self.__query_spec(), self.__fields))
  File "/usr/local/lib/python2.6/dist-packages/pymongo-1.9_-py2.6-linux-x86_64.egg/pymongo/cursor.py", line 521, in __send_message
    **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/pymongo-1.9_-py2.6-linux-x86_64.egg/pymongo/connection.py", line 743, in _send_message_with_response
    return self.__send_and_receive(message, sock)
  File "/usr/local/lib/python2.6/dist-packages/pymongo-1.9_-py2.6-linux-x86_64.egg/pymongo/connection.py", line 724, in __send_and_receive
    return self.__receive_message_on_socket(1, request_id, sock)
  File "/usr/local/lib/python2.6/dist-packages/pymongo-1.9_-py2.6-linux-x86_64.egg/pymongo/connection.py", line 714, in __receive_message_on_socket
    struct.unpack("<i", header[8:12])[0])
AssertionError: ids don't match -561338340 0
<Greenlet at 0x2baa628: <bound method Worker.work of <scripts.mainconverter.Worker object at 0x2ba8450>>> failed with AssertionError

この脱出の原因とこれを修正する方法を誰かが伝えることができます。

ありがとう。

役に立ちましたか?

解決

これは、Gevent Coroutinesでワーカースレッドを使用している方法に関連するスレッドの問題である可能性があります。 Pymongo Connectionオブジェクトは、それが行っていないリクエストの応答を読み取っているようです。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top