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

PyMongo ReplicaSetConnection monitor hanging in test suite

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.8, 3.0
    • Affects Version/s: 2.7.2
    • Component/s: None
    • Labels:

      We are updating from a properly ancient (2.1.x) version of pymongo, and everything has worked fine after some modifications except for our test suite.

      We connect to mongo, with a replica set, via mongoengine:

      conn = connect(None, host=host_string, replicaSet=replica_set)

      The test suite is under nose, and all tests pass except it hangs indefinitely (I can kill -9 or stop mongo). Tracing this, the monitor.join() call never returns, blocking on the thread forever.

      I've put in a call to explicitly disconnect from Mongo before the script exits, and confirm that it is being executed.

      MongoEngine's disconnect is closing all open connections prior to monitor.shutdown() (triggered by the atexit event) being called.

      Our test suite is pretty large, and this is difficult to reduce down. I'm a novice when it comes to threaded python, but am happy to do what I can to test or change with some guidance.


      (I did install gevent to see if the issue was present under gevent and it was)

            jesse@mongodb.com A. Jesse Jiryu Davis
            keen_jay Jay Shirley
            0 Vote for this issue
            3 Start watching this issue