Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-3639

Connection failure may take 1-2s when connecting to the wrong address on Windows

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None

      On Windows, attempted connections to the wrong address can take 1-2s to fail. I observed this when connecting to a mongod that was not bound to IPv6 (i.e. no  --ipv6 flag passed).

      For single-threaded monitoring, this is mitigated by happy eyeballs. But for establishing multi-threaded application connections, this could appear as a 1-2s block. After CDRIVER-3625, this will also effect multi-threaded monitoring.

      With some added debug logging, the delay occurs in the call to "select" here: https://github.com/mongodb/mongo-c-driver/blob/master/src/libmongoc/src/mongoc/mongoc-socket.c#L207

      Capturing traffic with wireshark shows repeated TCP retransmits (capture file attached).

      This branch includes more logging and a simplified example-client to reproduce: https://github.com/kevinAlbs/mongo-c-driver/tree/slow-select

        1. slow-select.pcapng
          2 kB
          Kevin Albertson

            Assignee:
            Unassigned Unassigned
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: