[CDRIVER-2058] heartbeatFrequencyMS is not validated as being less than minHeartbeatFrequencyMS Created: 16/Feb/17  Updated: 11/Sep/19  Resolved: 22/Mar/17

Status: Closed
Project: C Driver
Component/s: libmongoc, uri
Affects Version/s: 1.6.0
Fix Version/s: 1.7.0

Type: Task Priority: Minor - P4
Reporter: Jeremy Mikola Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CDRIVER-2060 localThresholdMS is not validated as ... Closed

 Description   

The SDAM spec states the following for heartbeatFrequencyMS:

For both multi- and single-threaded drivers, the driver MUST NOT permit users to configure it less than minHeartbeatFrequencyMS (500ms).

MONGOC_TOPOLOGY_MIN_HEARTBEAT_FREQUENCY_MS is defined as 500, but that value is never used to validate the heartbeatFrequencyMS option. It is only referenced mongoc_topology_select_server_id() for computing the allowed scan time in single-threaded mode and _mongoc_topology_run_background() when computing a shorter interval for a requested scan.

Should libmongoc report some error when a value smaller than 500 is specified for heartbeatFrequencyMS? Alternatively, are invalid heartbeatFrequencyMS values ignored based on the aforementioned topology scanner code, which references MONGOC_TOPOLOGY_MIN_HEARTBEAT_FREQUENCY_MS?



 Comments   
Comment by Githook User [ 22/Mar/17 ]

Author:

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

Message: CDRIVER-2058 prohibit small heartbeatfrequencyms values
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/8cf3e639f72f77dc092995ea9223791382adf626

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

Reading the code for mongoc_topology_select_server_id there's some question about whether we're up to spec at all. We should wait MAX(minheartbeatfrequency, heartbeatfrequency) between server checks, but it looks like we wait minheartbeatfrequency + heartbeatfrequency?

Additionally, as Jeremy says, it should be an error to specify:

mongodb://host/?heartbeatfrequencyms=1

Comment by Jeremy Mikola [ 16/Feb/17 ]

Cross-referencing with CDRIVER-2060, as it may make sense to use similar logic as mongoc_uri_get_local_staleness_option() and simply log a warning and return MONGOC_TOPOLOGY_MIN_HEARTBEAT_FREQUENCY_MS for an invalid value.

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