[CDRIVER-4047] SRV rescan interval incorrectly computes TTL and minimum time Created: 29/Jun/21  Updated: 27/Oct/23  Resolved: 06/Jul/21

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

Type: Bug Priority: Unknown
Reporter: Kevin Albertson Assignee: Unassigned
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

The SRV polling specification states:

The rescanSRVIntervalMS value MUST be set to the lowest of the individual TTL values associated with the different SRV records in the most recent rescan, but MUST NOT be lower than 60 seconds. If a driver is unable to access the TTL values of SRV records, it MUST rescan every 60 seconds.

libmongoc currently calculates the rescan interval as follows:

topology->srv_polling_rescan_interval_ms = BSON_MAX (
      rr_data.min_ttl * 1000, MONGOC_TOPOLOGY_MIN_RESCAN_SRV_INTERVAL_MS);

  • The calculation should be the minimum.
  • Test that the behavior is fixed by mocking SRV responses with a short TTL.

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