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

Document serverSelectionTimeoutMS. Clarify connectTimeoutMS / socketTimeoutMS.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial - P5
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.0.1
    • Component/s: None
    • Labels:
      None

      Description

      MongoClient supports the connectTimeoutMS, parameter:
      http://api.mongodb.org/python/current/api/pymongo/mongo_client.html

      connectTimeoutMS: (integer or None) How long (in milliseconds) a connection can take to be opened before timing out. Defaults to 20000.

      However with the latest Topology bits connections spend server_selection_timeout waiting for the initial connection (this is set to 30s by default):

      select_servers [topology.py:106]	
      select_server [topology.py:120]	
      _get_socket [mongo_client.py:651]	
      __enter__ [contextlib.py:17]	
      _socket_for_reads [mongo_client.py:687]	
      __enter__ [contextlib.py:17]	
      command [database.py:451]	
      server_info [mongo_client.py:886]	
      

      It would be good if connectTimeoutMS - which is the only parameter defined as API - influenced server_selection_timeout.

      Looking at the code it is possible to override server_selection_timeout by passing: serverselectiontimeoutms, but I can't find this documented.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              behackett Bernie Hackett
              Reporter:
              jblackburn James Blackburn
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: