Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-86269

stdx::condition_variable starves waiters who don't use waitForConditionOrInterrupt

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Server Programmability
    • ALL
    • 19

      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            louis.williams@mongodb.com Louis Williams
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: