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

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Internal Code
    • None
    • Fully Compatible
    • ALL
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            Unassigned
            Reporter:
            Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: