Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-413

MemoryError while retrieving large cursors

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.4
    • Affects Version/s: None
    • Component/s: None
    • None

      Python version v2.7.2 (on Windows)
      Mongo v2.0.7 (running on ubuntu)

      >>> ================================ RESTART================================
      >>> from pymongo import Connection
      >>> c = Connection("mongodb://user:pswd@mongo/admin")
      >>> c_users  = c["data"]["user"]
      >>> users = c_users.find({}, ["_id"])
      >>> users.count()
      193845
      >>> for u in users:
          s = u["_id"]
      
      Traceback (most recent call last):
        File "<pyshell#24>", line 1, in <module>
          for u in users:
        File "build\bdist.win32\egg\pymongo\cursor.py", line 778, in next
          if len(self.__data) or self._refresh():
        File "build\bdist.win32\egg\pymongo\cursor.py", line 742, in _refresh
          limit, self.__id))
        File "build\bdist.win32\egg\pymongo\cursor.py", line 666, in __send_message
          **kwargs)
        File "build\bdist.win32\egg\pymongo\connection.py", line 907, in _send_message_with_response
          return self.__send_and_receive(message, sock_info)
        File "build\bdist.win32\egg\pymongo\connection.py", line 885, in __send_and_receive
          return self.__receive_message_on_socket(1, request_id, sock_info)
        File "build\bdist.win32\egg\pymongo\connection.py", line 877, in __receive_message_on_socket
          return self.__receive_data_on_socket(length - 16, sock_info)
        File "build\bdist.win32\egg\pymongo\connection.py", line 858, in __receive_data_on_socket
          chunk = sock_info.sock.recv(length)
      MemoryError
      >>>
      

      At this point I am not even convinced that this is pymongo's issue, and not python's, but the change seems to fix the this without any other bad side affects.

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            tomasb Tomas Bajarunas
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: