[CDRIVER-2052] Correct connectTImeoutMS Created: 14/Feb/17  Updated: 03/May/17  Resolved: 28/Feb/17

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 1.2
Fix Version/s: 1.7.0

Type: Improvement Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to PHPC-723 Blocking connect() leads to cumulativ... Closed

 Description   

The C Driver's topology scanner has a hard limit of connectTimeoutMS that spans the period between calling mongoc_async_run to begin discovering, and when mongoc_async_run finishes. Some requests might begin in the middle of the call to mongoc_async_run, because we start checking a server newly discovered in the host list of an isMaster response immediately, but we don't reset the timer when we do so.

This ignores connectTimeoutMS's purpose: it's not for limiting the duration of mongoc_async_run, it's for distinguishing between a server that's slow to respond vs. a server that's down.

Track the duration of server checks per-server, instead of for the entire event loop. Let the loop run a bit longer to give newly discovered servers a fair timeout.

Note, mongoc_async_run's original design tried to do this. Then it had an awkward phase when it enforced timeouts both per-server and for the entire function call. Then I rewrote it to only enforce the timeout for the whole function. That was a mistake, instead we should get rid of the whole-function timeout and only track timeouts per-server.



 Comments   
Comment by Githook User [ 28/Feb/17 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-2052 measure connectTimeoutMS per server
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/930ab068a85156b68edba445d20b2082b3bc5ee4

Comment by A. Jesse Jiryu Davis [ 21/Feb/17 ]

Before finishing this ticket, change the int32_t mongoc_async_cmd_t.timeout_msec to int64_t mongoc_async_cmd_t.connect_timeout_usec. Simpler math, clearer purpose.

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