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

Avoid using barriers in TimestampMonitorNotifiesListeners to avoid deadlock in test

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.9
    • Affects Version/s: None
    • Component/s: Storage
    • None
    • Fully Compatible
    • ALL
    • Storage NYC 2019-03-25
    • 13

      We should change the usage of barriers in `TimestampMonitorNotifiesListeners` to use a mutex and condition variable instead. Using barriers in this test can lead to a deadlock scenario.

      For example, while the first thread is adding listeners, the timestamp monitor in the second thread can start notifying listeners that were already added by the first thread. While this happens, the timestamp monitor holds its own mutex and waits for the barrier in the test. This prevents the first thread from continuing to add listeners as it needs to grab the timestamp monitors mutex. The deadlock occurs here as the first thread will never hit the barrier that the second thread is waiting for.

            Assignee:
            gregory.wlodarek@mongodb.com Gregory Wlodarek
            Reporter:
            gregory.wlodarek@mongodb.com Gregory Wlodarek
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: