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

Index cache isn't thread safe

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

      When creating an index on mongo, pymongo raised following exception:

      Exception in thread 858:
      Traceback (most recent call last):
        File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
          self.run()
        File "/usr/lib/python2.7/threading.py", line 763, in run
          self.__target(*self.__args, **self.__kwargs)
        File "parallel_index_creation.py", line 17, in thread_run
          col.ensure_index('field1', cache_for=-1)
        File ".../pymongo/collection.py", line 1406, in ensure_index
          self.__name, name):
        File ".../pymongo/mongo_client.py", line 439, in _cached
          now < cache[dbname][coll][index])
      KeyError: u'field1_1'
      

      I have attached small script that reproduces it (after few runs).

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            uosiu Stanis?aw Skonieczny
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: