Non-atomic reference counting in threaded aggregation.

XMLWordPrintableJSON

    • Fully Compatible
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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.

              Assignee:
              Chris Westin (Inactive)
              Reporter:
              Sergey Mitsyn
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: