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

Monitor threads slow to terminate on application shutdown.

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

      You can see this running the unit tests locally. The test suite hangs for some time before completing. This is also causing confusion in the community, with users assuming PyMongo 3 is "slow" for certain styles of benchmarks. For example:

      http://stackoverflow.com/questions/30334438/pymongo-3-0-2-slower-than-2-8-1/30338779#30338779

      The problem appears to be in periodic_executor.py. When the close() method is called self._stop is set to True but there is no call to wake(). This means the thread blocks for up to 10 seconds before waking and terminating.

      https://github.com/mongodb/mongo-python-driver/blob/master/pymongo/periodic_executor.py#L75

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            bernie@mongodb.com Bernie Hackett
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: