2011-01-27 6 views
5

내가 사용과 일치하지 않습니다Pymongo AssertionError를 : ID를

  • MongoDB를 1.6.5
  • 을 Pymongo 1.9
  • 파이썬은 2.6.6

나는 데몬의 3 개 종류가있다. 1 차 웹에서 데이터로드, 2 차 분석 및 결과 저장, 3 차 그룹 결과 그들 모두 몽고 ​​트와 협력하고 있습니다. 시간이 3 데몬에서 는 (DB에서 데이터의 큰 금액이 있습니다 대부분의 경우)과 같은 많은 예외를 throw :

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 

사람이 무엇을이 exeption 원인과 방법이 문제를 해결하는 방법 알 수 있습니다.

감사합니다.

+0

[email protected]이 도움이된다고 말했습니다. http://jira.mongodb.org/browse/PYTHON-166 –

답변

4

이것은 gevent coroutines에서 작업자 스레드를 사용하는 방법과 관련된 스레드 문제 일 수 있습니다. pymongo 연결 객체가 요청하지 않은 요청에 대한 응답을 읽는 것 같습니다.

+0

당신은 절대적으로 적절합니다. 커서가 출력을 완료하기 전에 일부 연결이 풀로 반환되는 것을 발견했습니다. –

+3

그럼, 어떻게 해결할 수 있을까요? 나는 같은 문제를 겪고 있고 어떻게 풀 수 있을까. – CIF

관련 문제