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

Abandon snapshot after read in AuthzManagerExternalStateMongod::findOne

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.8
    • Affects Version/s: None
    • Component/s: Security
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Security 2018-12-03, Security 2018-12-17, Security 2019-01-14, Security 2019-01-28, Security 2019-02-11
    • 52

      AuthzManagerExternalStateMongod::findOne uses AutoGetCollectionForReadCommand to get the lock and does the read. Normally, the destructor of AutoGetCollectionForReadCommand would abandon the WiredTiger snapshot due to the destructor of Global lock. However, we may enter this findOne function with AuthzLock (a Database S lock and thus a Global IS lock). So therefore the destructor would not abandon the snapshot

      In the linked BF, the first read opened a transaction and the second read just continued that transaction. If the snapshot is invalid for the second read, there is no way to set the readSource since the transaction is already active.

      The fix would be to abandon the snapshot after the first read or always abandon snapshots before any findOne() so each read would be independently using its own snapshot/transaction.

      If two reads have to be on the same transaction/snapshot, we definitely need a better way, especially if they are on two different collections.

            Assignee:
            jonathan.reams@mongodb.com Jonathan Reams
            Reporter:
            xiangyu.yao@mongodb.com Xiangyu Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: