Determine if thread safety comment in BSONObj is still true

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.3.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Server Programmability
    • Fully Compatible
    • Programmability 2026-02-02, Programmability 2026-03-02
    • 200
    • None
    • None
    • None
    • None
    • None
    • None
    • None

       In BSONObj we have a comment that copying and destroying BSONObj's is not thread safe. 

      Note that BSONObj's have a smart pointer capability built in -- so you can pass them around by value. The reference counts used to implement this do not use locking, so copying and destroying BSONObj's are not thread-safe operations.

      In BF-41644 there is some discussion on this. Since the underlying ConstSharedBuffer appears to be thread safe for reference counting it's possible BSONObj is too and this comment is not relevant anymore. 
       

            Assignee:
            Billy Donahue
            Reporter:
            Denis Trailin
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: