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

Race between Baton::notify() and Waitable::wait()

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.0.5, 4.1.6
    • Affects Version/s: 4.0.0, 4.1.4
    • Component/s: Networking
    • None
    • Fully Compatible
    • ALL
    • v4.0
    • Service Arch 2018-11-05, Service Arch 2018-11-19

      If notify() is called after the Baton's run() method does its final check of the queue and the point where wait() relocks the mutex, it will push an empty task to the queue which won't have a chance to run before the Baton is detached from the OperationContext. This causes an invariant failure when detach() asserts that the queue is empty.

      This race also exists in 4.0 with a larger window: any time the operation is killed between the last call to run() and the call to detach().

      The fix for both branches will be to not schedule the empty task on killop and instead just always tap the event fd.

      Until this is fixed, it can be worked around by setting the AsyncRequestsSenderUseBaton server parameter to false.

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            mathias@mongodb.com Mathias Stearn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: