Silently ignoring greenlet.GreenletExit exception

XMLWordPrintableJSON

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

      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 Hackett
              Reporter:
              Lev
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: