Make explicit OperationFailure check on retryable read error handling

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 4.6, 4.6.1
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Detailed steps to reproduce the problem?

      Include full traceback, if possible

      Caught in MOTOR-1182

       __ 
      Pymongo is retrying a failed find connection ONCE that has a 0 or NoneType error code. 

      • This is undesired behavior because if, theoretically, we introduce an error type that does not have an error code but is an instance of an `OperationFailure`, we will mistakenly retry leading to unexpected consequences.

      Definition of done: what must be done to consider the task complete?

      Rather than exc_code and exc_code not in RETRIABLES
      just having
      isinstance(err, OperationFailure) and exc_code not in RETRIABLES  is significantly more explicit and should resolve the bug.

      The exact Python version used, with patch level:

      3.8+

      The exact version of PyMongo used, with patch level:

      PyMongo 4.6.0 

      Describe how MongoDB is set up. Local vs Hosted, version, topology, load balanced, etc.

      MongoDB set up from motor tests

      The operating system and version (e.g. Windows 7, OSX 10.8, ...)

      Web framework or asynchronous network library used, if any, with version (e.g. Django 1.7, mod_wsgi 4.3.0, gevent 1.0.1, Tornado 4.0.2, ...)

      Security Vulnerabilities

      If you’ve identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here

              Assignee:
              Jib Adegunloye
              Reporter:
              Jib Adegunloye
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: