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

ServiceContext getters/setters are racing

    XMLWordPrintable

Details

    • Fully Compatible
    • ALL
    • Hide

      BF-18712

      Show
      BF-18712
    • Service arch 2020-10-05, Service arch 2020-10-19, Service Arch 2021-03-08, Service Arch 2021-03-22, Service Arch 2021-04-05, Service Arch 2021-04-19, Service Arch 2021-05-17, Service Arch 2021-07-12, Service Arch 2021-08-09
    • 26
    • 4

    Description

      BF-18712 shows a TSAN true positive where setFastClockSource races with getFastClockSource due to latch_detail::Mutex::_onContendedLock's invocation of getFastClockSource before the setFastClockSource could occur.

      There is no synchronization on the unique_ptr fields of ServiceContext, so these problems are unavoidable. Rather than making new obscure rules about when it's ok to call the getters, we can rather easily add synchronization to these fields, as they are private members. They could be stored in a synchronized unique_ptr wrapper.

       

      Acceptance Criteria: 

      ServiceContext will call terminate if a setter happens after a given property has been accessed. Create a patch build to reproduce this and identify all the use cases where this was happening to create tickets that require a fix. 

      Attachments

        Issue Links

          Activity

            People

              backlog-server-servicearch Backlog - Service Architecture
              billy.donahue@mongodb.com Billy Donahue
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: