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

Have ephemeralForTest use std::mutex for protecting its internal data structures

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.4.7, 3.5.7
    • Affects Version/s: None
    • Component/s: Storage
    • Fully Compatible
    • v3.4
    • Storage 2017-04-17, Storage 2017-05-08
    • 0

      The LockManager was used for ephemeralForTest reader/writer locks, but the LockManager has a limitation on the number of locks that can be taken by one thread at a time. Exceeding that limit now causes an exception to be thrown. Exceptions cannot safely escape catch blocks. `rollback` methods are called from within catch blocks and thus in no circumstances can throw. By implication, rollback methods cannot acquire locks managed by the LockManager.

      The simple fix here is to replace the RW lock with a std[x]::mutex. This will prevent concurrent readers when using ephemeralForTest. However, because the critical section is fast and using a std::mutex is likely to be faster than managing RW locks, there may be no performance loss at all.

            daniel.gottlieb@mongodb.com Daniel Gottlieb (Inactive)
            daniel.gottlieb@mongodb.com Daniel Gottlieb (Inactive)
            0 Vote for this issue
            1 Start watching this issue