MongoClient should perform SRV resolution lazily

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major - P3
    • 4.12
    • Affects Version/s: None
    • Component/s: SDAM
    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      MongoClient currently performs the SRV+TXT resolution directly in the constructor. The downside is that if the SRV or TXT lookup fails due to a transient DNS error then the entire client fails to be created.

      MongoClient should perform SRV resolution lazily to make it more robust. If the SRV resolution consistently fails, then the first operation should raise an informative server selection error indicating the SRV/TXT error.

      I'm thinking we can defer the initial SRV/TXT lookup to the client's background thread.

      NOTE: AsyncMongoClient no longer performs dns resolution for "mongodb+srv://" connection string in the constructor. To avoid blocking the asyncio loop, the resolution is now deferred until the client is first connected.

            Assignee:
            Iris Ho
            Reporter:
            Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: