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

ViewDefinitions obtained from ViewCatalog are freed on reload

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical - P2
    • Resolution: Fixed
    • None
    • 3.3.12
    • Querying
    • Fully Compatible
    • ALL
    • 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

            kyle.suarez@mongodb.com Kyle Suarez
            kyle.suarez@mongodb.com Kyle Suarez
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: