Transient ServerSelectionTimeoutError

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 4.13.2
    • Component/s: django, Query Operations
    • None
    • Python Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Detailed steps to reproduce the problem?

      Mongo operations via pymongo fail to execute transiently for both reads and writes with the error: "pymongo.errors.ServerSelectionTimeoutError: No replica set members match selector "Primary()". 

      Workarounds employed:

      For reads: The error gets fixed if read_preferences are set to SECONDARY_PREFERRED.

      For writes: For the above exception: retrying with the same connection results in success responses.

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

      No transient errors for both reads or writes. 

      The exact Python version used, with patch level:

      3.12.11 (main, Jul 22 2025, 01:45:44) [GCC 12.2.0]

      The exact version of PyMongo used, with patch level:

      4.13.2

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

      Hosted, with AWS VPC peering (AWS hosted instances are on private sub net). 

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

      Debian GNU/Linux 12 (bookworm)

      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, ...)

      Django 5.1.4

              Assignee:
              Steve Silvester
              Reporter:
              Pranav Mehta
              Votes:
              4 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated: