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

mongo::sorter::nextFileNumber incorrectly assumes thread-safe initialization of function statics

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Internal Code
    • None
    • Fully Compatible
    • ALL

    Description

      https://github.com/mongodb/mongo/blob/master/src/mongo/db/sorter/sorter.cpp#L768

      In C++03, the initialization of function statics is not thread-safe (it is in C++11). While some compilers, notably GCC, actually implement thread-safe statics in C++03 mode by default unless asked not to, other compilers do not.

      On such platforms, it could be possible for the atomic to be initialized twice, probably leading to inconsistent results.

      Attachments

        Activity

          People

            Unassigned Unassigned
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: