[SERVER-62682] PrimaryOnlyService Does Not Call _rebuildCV.notify_all() leading to calls to waitForConditionOrInterrupt not being triggered Created: 14/Jan/22  Updated: 29/Oct/23  Resolved: 26/Jan/22

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 5.3.0, 5.2.1, 5.0.7

Type: Bug Priority: Major - P3
Reporter: Luis Osta (Inactive) Assignee: Luis Osta (Inactive)
Resolution: Fixed Votes: 0
Labels: sharding-nyc-subteam1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
related to SERVER-62884 Simplify synchronization semantics of... Open
is related to SERVER-51650 Primary-Only Service's _rebuildCV sho... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.2, v5.0
Steps To Reproduce:

Te test included in the PR 'LookUpInstanceHangsForever' reproduces the issue.

Sprint: Sharding 2022-01-24, Sharding 2022-02-07
Participants:
Linked BF Score: 35
Story Points: 2

 Description   

Since PrimaryOnlyService does not adhere to the contract of notifying the users of the condition variable whenever the underlying _state variable changes, its possible for its users such as lookUpInstance to end up waiting forever on the condition or interrupt

For instance on step down, the function updates the _state to kPaused but does not notify the condition variable

Adding a _rebuildCV.notify_all() after every update to _state should fix this issue.



 Comments   
Comment by Githook User [ 26/Jan/22 ]

Author:

{'name': 'Luis Osta', 'email': 'luis.osta@mongodb.com', 'username': 'LuisOsta'}

Message: SERVER-62682 Add _rebuildCV.notify_all() after all mutations to _state

(cherry picked from commit fd6fb9e6a49955828c12355e33edf8b328e44a43)
Branch: v5.0
https://github.com/mongodb/mongo/commit/f27135ef2b94b67806614cea3e72216187897e7e

Comment by Githook User [ 26/Jan/22 ]

Author:

{'name': 'Luis Osta', 'email': 'luis.osta@mongodb.com', 'username': 'LuisOsta'}

Message: SERVER-62682 Add _rebuildCV.notify_all() after all mutations to _state

(cherry picked from commit fd6fb9e6a49955828c12355e33edf8b328e44a43)
Branch: v5.2
https://github.com/mongodb/mongo/commit/9896465dce171454a8311294d6485f4e5408449d

Comment by Githook User [ 26/Jan/22 ]

Author:

{'name': 'Luis Osta', 'email': 'luis.osta@mongodb.com', 'username': 'LuisOsta'}

Message: SERVER-62682 Add _rebuildCV.notify_all() after all mutations to _state
Branch: master
https://github.com/mongodb/mongo/commit/fd6fb9e6a49955828c12355e33edf8b328e44a43

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