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

serverSelectionTimeoutMS not respected in some instances

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial - P5
    • Resolution: Works as Designed
    • Affects Version/s: 3.0
    • Fix Version/s: None
    • 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

          Activity

            People

            Assignee:
            jesse A. Jesse Jiryu Davis
            Reporter:
            jblackburn James Blackburn
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: