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

Silently ignoring greenlet.GreenletExit exception

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial - P5
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6
    • Component/s: Connection Management
    • Labels:
      None
    • Environment:
      CPython 2.7, gevent

      Description

      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

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: