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

AssertionError: Result batch started from 101, expected 0

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker - P1
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.0.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      MongoDB 2.4.6

      Description

      I can easily reproduce this in our tests when trying to list database collection.

      Our current deployment in 2.4.6 based, so this appears to block a pymongo driver upgrade.

      Create a new MongoDB instance:

      * /opt/ahl/releases/mongodb/2.4.6/bin/mongod --dbpath /scratch/user/jblackburn/tmp/test_mongo/
      

      In Python

      * ipython
      Python 2.7.3 (default, Apr 29 2013, 16:01:51) 
      Type "copyright", "credits" or "license" for more information.
       
      IPython 2.3.0-1 -- An enhanced Interactive Python.
      ?         -> Introduction and overview of IPython's features.
      %quickref -> Quick reference.
      help      -> Python's own help system.
      object?   -> Details about 'object', use 'object??' for extra details.
       
      In [1]: import pymongo
      /local/home/jblackburn/pyenvs/research/lib/python2.7/site-packages/pymongo-3.0-py2.7-linux-x86_64.egg/bson/_cbson.py:3: UserWarning: Module readline was already imported from /local/home/jblackburn/pyenvs/research/lib/python2.7/site-packages/ipython-2.3.0_1_ahl1-py2.7.egg/IPython/utils/rlineimpl.py, but /local/home/jblackburn/pyenvs/research/lib/python2.7/site-packages/readline-6.2.1-py2.7-linux-x86_64.egg is being added to sys.path
       
      In [2]: c = pymongo.MongoClient('cn94:27017')
       
      In [3]: for i in xrange(100):
         ...:     c.db["coll{}".format(i)].insert_one({})
         ...:     
       
      In [4]: c.database_names()
      Out[4]: [u'db', u'local']
       
      In [5]: c.db.collection_names()
      ---------------------------------------------------------------------------
      AssertionError                            Traceback (most recent call last)
      <ipython-input-5-0923a89f45d2> in <module>()
      ----> 1 c.db.collection_names()
       
      /local/home/jblackburn/pyenvs/research/lib/python2.7/site-packages/pymongo-3.0-py2.7-linux-x86_64.egg/pymongo/database.py in collection_names(self, include_system_collections)
          486 
          487             results = self._list_collections(sock_info, slave_okay)
      --> 488             names = [result["name"] for result in results]
          489             if sock_info.max_wire_version <= 2:
          490                 # MongoDB 2.4 and older return index namespaces and collection
       
      /local/home/jblackburn/pyenvs/research/lib/python2.7/site-packages/pymongo-3.0-py2.7-linux-x86_64.egg/pymongo/command_cursor.py in next(self)
          166         """Advance the cursor.
          167         """
      --> 168         if len(self.__data) or self._refresh():
          169             coll = self.__collection
          170             return coll.database._fix_incoming(self.__data.popleft(), coll)
       
      /local/home/jblackburn/pyenvs/research/lib/python2.7/site-packages/pymongo-3.0-py2.7-linux-x86_64.egg/pymongo/command_cursor.py in _refresh(self)
          135         if self.__id:  # Get More
          136             self.__send_message(
      --> 137                 _GetMore(self.__ns, self.__batch_size, self.__id))
          138 
          139         else:  # Cursor id is zero nothing else to return
       
      /local/home/jblackburn/pyenvs/research/lib/python2.7/site-packages/pymongo-3.0-py2.7-linux-x86_64.egg/pymongo/command_cursor.py in __send_message(self, operation)
          118         assert doc["starting_from"] == self.__retrieved, (
          119             "Result batch started from %s, expected %s" % (
      --> 120                 doc['starting_from'], self.__retrieved))
          121 
          122         self.__retrieved += doc["number_returned"]
       
      AssertionError: Result batch started from 101, expected 0
       
      In [6]: 
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              behackett Bernie Hackett
              Reporter:
              jblackburn James Blackburn
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: