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

Test suite failure in test_collection, drop_collection race condition?

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.2.1
    • Affects Version/s: None
    • Component/s: Tests
    • None
    • Environment:
      Centos 5.8 using mongo-10gen-server-2.0.5

      I'm experience sporadic failures in the pymongo test suite. About 1 in 10 times I run it I see a failure of some kind in test_collection. test_large_limit() fails occasionally because the collection that it uses, pymongo_test.test somehow still contains data left over from the test_invalid_key_names() test. Sometimes there are 3 of the documents left from that test, sometimes 4. So instead of having the expected 2000 elements in the collection at the end of test_large_limit, there are 2003 or 2004. Here's what shows up in the log file during one failure:

      Mon Jun 4 11:19:45 [initandlisten] connection accepted from 127.0.0.1:34261 #73243
      Mon Jun 4 11:19:45 [conn73237] end connection 127.0.0.1:34258
      Mon Jun 4 11:19:45 [conn73240] CMD: drop pymongo_test.test
      Mon Jun 4 11:19:45 [conn73240] build index pymongo_test.test

      { _id: 1 }

      Mon Jun 4 11:19:45 [conn73240] build index done 0 records 0.001 secs
      Mon Jun 4 11:19:45 [conn73240] info: creating collection pymongo_test.test on add index
      Mon Jun 4 11:19:45 [conn73240] build index pymongo_test.test

      { x: 1 }

      Mon Jun 4 11:19:45 [conn73240] build index done 0 records 0.002 secs
      Mon Jun 4 11:19:45 [conn73236] end connection 127.0.0.1:34257
      Mon Jun 4 11:19:47 [conn6325] info DFM::findAll(): extent 0:af6000 was empty, skipping ahead. ns:stats.recent
      Mon Jun 4 11:19:50 [FileAllocator] done allocating datafile /var/lib/mongod/pymongo_test.3, size: 512MB, took 4.861 secs
      Mon Jun 4 11:20:37 [clientcursormon] mem (MB) res:1096 virt:10453 mapped:4959

      I occasionally also see failures in test_distinct(), from what seems to be a related issue. The first insert in that test, test.save(

      {"a": 1}

      ), seems to somehow happen before the drop_collection, so that when the collection is checked at the end of the test, that value is missing from the collection.

      I've run the tests with --pdb-failures, and have checked db.error(), however there are none listed.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jhalcrow Jonathan Halcrow
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: