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

Non-atomic reference counting in threaded aggregation.

    XMLWordPrintableJSON

Details

    • Fully Compatible
    • ALL

    Description

      With aggregation command, expressions use shared Value instances across multiple threads. Such shared instances may be got using eg. Value::getTrue().

      As mongo::Value is reference counted with mongo::IntrusiveCounter, operations on counter are not atomic. With two or more simultaneous aggregations being run this (may) results in freeing of shared values that are being used and thus strange errors like double free detected by glibc or assertions in Value::coerceToBool() for boolean Value. .

      This 'bug' can be fixed by changing IntrusiveCounter's counter variable type to bson::AtomicUInt, which is ugly but works. Maybe the final fix shouldn't be so radical.

      Attachments

        Issue Links

          Activity

            People

              cwestin Chris Westin
              smitsyn Sergey Mitsyn
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: