[SERVER-86269] stdx::condition_variable starves waiters who don't use waitForConditionOrInterrupt Created: 06/Feb/24  Updated: 07/Feb/24

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

Type: Bug Priority: Major - P3
Reporter: Louis Williams Assignee: Backlog - Service Architecture
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-86247 Non-Linux SemaphoreTicketHolder starv... In Code Review
Assigned Teams:
Service Arch
Operating System: ALL
Participants:
Linked BF Score: 19

 Description   

Our hand-rolled condition variable implementation wakes waiters that enter through the _runWithNotifyable entry point (i.e. waitForConditionOrInterrupt) before it signals any waiters who have called regular wait() or wait_until().

When contended, this completely starves out the regular waiters. I'm not sure if this is intended behavior, but at the very least, the API does not provide the fairness guarantees that a caller may assume.

It seems like we probably shouldn't pretend that stdx::condition_variable has the same behavior as a regular condition variable, and require that callers always go through the poll/Baton code or not at all.


Generated at Thu Feb 08 06:59:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.