[CDRIVER-3639] Connection failure may take 1-2s when connecting to the wrong address on Windows Created: 28/Apr/20  Updated: 05/Feb/24

Status: Backlog
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Kevin Albertson Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: bg-rf, neweng, platform-problems
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File slow-select.pcapng    
Issue Links:
Related
related to CDRIVER-3965 Version 1.17.5 adds a 4 seconds delay... Closed
is related to PYTHON-356 Windows localhost connection slowdowns. Closed
Epic Link: Improve Developer Experience

 Description   

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



 Comments   
Comment by Kevin Albertson [ 28/Apr/20 ]

This is likely the same behavior described in PYTHON-356.

Generated at Wed Feb 07 21:18:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.