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

ServerTransactionsMetrics should synchronize access to non-atomic members

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.6
    • Affects Version/s: None
    • Component/s: Replication
    • None
    • Fully Compatible
    • ALL
    • Repl 2018-12-03
    • 73

      The ServerTransactionsMetrics class is a service context decoration that maintains server-wide stats for transactions, including the opTimes of uncommitted/aborted transactions. The sets of opTimes are modified by TransactionParticipant through the TransactionMetricsObserver in several places (e.g. onPrepare) and by the ReplicationCoordinator when getting the stable timestamp. There is no internal synchronization for the lists of opTimes, so they can be concurrently modified, leading to data races.

      A simple fix would be to add a mutex to ServerTransactionsMetrics that protects these variables. The other member variables in the class are atomics, so they are already thread-safe.

            Assignee:
            pavithra.vetriselvan@mongodb.com Pavithra Vetriselvan
            Reporter:
            jack.mulrow@mongodb.com Jack Mulrow
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: