[SERVER-56369] Timeout passed to ReplicaSetMonitor::getHostOrRefresh() is ignored by inner Refresher::_refreshUntilMatches() which spins forever Created: 26/Apr/21  Updated: 06/Dec/22  Resolved: 21/May/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 4.0.24
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Andrew Shuvalov (Inactive) Assignee: [DO NOT USE] Backlog - Sharding NYC
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Sharding NYC
Operating System: ALL
Participants:

 Description   

There are many code paths that invoke

   StatusWith<HostAndPort> getHostOrRefresh(const ReadPreferenceSetting& readPref,
                                             Milliseconds maxWait = kDefaultFindHostTimeout);

here. The default value is 15 seconds.

The timeout is not passed down to `refresher.refreshUntilMatches(criteria)` 20 lines lower. Essentially it is coded to spin forever here.



 Comments   
Comment by Lamont Nelson [ 21/May/21 ]

The timeout is enforced here: https://github.com/mongodb/mongo/blob/63026dcec31e315648cefb79630308868d983203/src/mongo/client/replica_set_monitor.cpp#L305

The second loop terminates when the object enters the DONE state.

Generated at Thu Feb 08 05:39:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.