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

ViewDefinitions obtained from ViewCatalog are freed on reload

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical - P2
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.12
    • Component/s: Querying
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Sprint:
      Integration 2016-08-29

      Description

      1. Thread A calls ViewCatalog::lookup() and obtains a raw ViewDefinition*.
      2. Thread B inserts a valid view directly into system.views. ViewCatalog::_valid is marked as false. (Note that this insert is possible because Thread A locks the database in MODE_IS, which does not conflict with a MODE_IX lock obtained by Thread B. Other commands that modify the view definitions require a MODE_X lock; i.e. create, collMod, drop.)
      3. Thread C calls a method of ViewCatalog, which implicitly reloads the catalog, clearing the old ViewMap, freeing all of the old ViewDefinitions.
      4. All iterators to the old ViewMap are now invalidated and all the ViewDefinition pointers have been freed, but Thread A might still be holding onto the ViewDefinition and may try to use it, resulting in undefined behavior.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: