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

Race in wiredTigerPrepareConflictRetry

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.9
    • Affects Version/s: None
    • Component/s: Storage
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Storage NYC 2019-02-11, Storage NYC 2019-02-25
    • 17

      In wiredTigerPrepareConflictRetry, we make the attempt to do the read here

      https://github.com/mongodb/mongo/blob/916a5553/src/mongo/db/storage/wiredtiger/wiredtiger_prepare_conflict.h#L66

      We then wait by noting the value of the _lastCommitOrAbortCounter and waiting for it to change here:

      https://github.com/mongodb/mongo/blob/916a5553/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp#L336

      But we don't lock the mutex associated with _lastCommitOrAbortCounter until here

      https://github.com/mongodb/mongo/blob/916a5553/src/mongo/db/storage/wiredtiger/wiredtiger_session_cache.cpp#L334

      So if _lastCommitOrAbortCounter updates after the prepare conflict but before we get the lock, we could wait indefinitely

            Assignee:
            xiangyu.yao@mongodb.com Xiangyu Yao (Inactive)
            Reporter:
            matthew.russotto@mongodb.com Matthew Russotto
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: