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

Silently ignoring greenlet.GreenletExit exception

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Trivial - P5 Trivial - P5
    • 3.6
    • Affects Version/s: None
    • Component/s: Connection Mgmt
    • None
    • Environment:
      CPython 2.7, gevent

      When using pymongo inside greenlets with gevent.monkey.patch_all like so:

      from gevent.monkey import patch_all
      patch_all()
      from gevent import spawn
      from pymongo import MongoClient
      
      client = MongoClient()
      
      def poller():
          while True:
              client.db.test_col.insert({'foo': 'bar'})
      
      def main():
          task = spawn(poller)
          task.kill()
          assert task.dead
      

      There is a possibility of poller will not be killed, as GreenletExit will be eaten here: https://github.com/mongodb/mongo-python-driver/blob/master/pymongo/network.py#L234

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            lorekhov Lev
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: