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

Segfault updating deeply nested document

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • None
    • None
    • None
    • None
    • Fully Compatible

    Description

      An update that modifies a document so as to increase its nesting depth to about 3000 produces a segfault due to a deeply nested recursion with the following stack trace:

      ...
      #6109 0x000000000099f857 in void mongo::mutablebson::Document::Impl::writeChildren<mongo::BSONObjBuilder>(unsigned int, mongo::BSONObjBuilder*) const ()
      #6110 0x000000000099f3d6 in void mongo::mutablebson::Document::Impl::writeElement<mongo::BSONObjBuilder>(unsigned int, mongo::BSONObjBuilder*, mongo::StringData const*) const ()
      #6111 0x000000000099f857 in void mongo::mutablebson::Document::Impl::writeChildren<mongo::BSONObjBuilder>(unsigned int, mongo::BSONObjBuilder*) const ()
      #6112 0x000000000099f3d6 in void mongo::mutablebson::Document::Impl::writeElement<mongo::BSONObjBuilder>(unsigned int, mongo::BSONObjBuilder*, mongo::StringData const*) const ()
      #6113 0x000000000099f857 in void mongo::mutablebson::Document::Impl::writeChildren<mongo::BSONObjBuilder>(unsigned int, mongo::BSONObjBuilder*) const ()
      #6114 0x000000000099f3d6 in void mongo::mutablebson::Document::Impl::writeElement<mongo::BSONObjBuilder>(unsigned int, mongo::BSONObjBuilder*, mongo::StringData const*) const ()
      #6115 0x000000000099f857 in void mongo::mutablebson::Document::Impl::writeChildren<mongo::BSONObjBuilder>(unsigned int, mongo::BSONObjBuilder*) const ()
      #6116 0x000000000099f3d6 in void mongo::mutablebson::Document::Impl::writeElement<mongo::BSONObjBuilder>(unsigned int, mongo::BSONObjBuilder*, mongo::StringData const*) const ()
      #6117 0x000000000099f857 in void mongo::mutablebson::Document::Impl::writeChildren<mongo::BSONObjBuilder>(unsigned int, mongo::BSONObjBuilder*) const ()
      #6118 0x000000000099f3d6 in void mongo::mutablebson::Document::Impl::writeElement<mongo::BSONObjBuilder>(unsigned int, mongo::BSONObjBuilder*, mongo::StringData const*) const ()
      #6119 0x000000000099f857 in void mongo::mutablebson::Document::Impl::writeChildren<mongo::BSONObjBuilder>(unsigned int, mongo::BSONObjBuilder*) const ()
      #6120 0x0000000000a4c708 in mongo::mutablebson::Document::getObject() const ()
      #6121 0x0000000000befdd4 in mongo::UpdateStage::transformAndUpdate(mongo::Snapshotted<mongo::BSONObj> const&, mongo::RecordId&) ()
      #6122 0x0000000000bf0938 in mongo::UpdateStage::work(unsigned long*) ()
      #6123 0x0000000000e05f25 in mongo::PlanExecutor::getNextImpl(mongo::Snapshotted<mongo::BSONObj>*, mongo::RecordId*) ()
      #6124 0x0000000000e065e9 in mongo::PlanExecutor::getNext(mongo::BSONObj*, mongo::RecordId*) ()
      #6125 0x0000000000e066e5 in mongo::PlanExecutor::executePlan() ()
      

      or the following stack trace, depending on the circumstances:

      ...
      #5124 0x0000000000bed839 in mongo::(anonymous namespace)::storageValidChildren(mongo::mutablebson::ConstElement const&, bool) ()
      #5125 0x0000000000becb67 in mongo::(anonymous namespace)::storageValid(mongo::mutablebson::ConstElement const&, bool) ()
      #5126 0x0000000000bed839 in mongo::(anonymous namespace)::storageValidChildren(mongo::mutablebson::ConstElement const&, bool) ()
      #5127 0x0000000000becb67 in mongo::(anonymous namespace)::storageValid(mongo::mutablebson::ConstElement const&, bool) ()
      #5128 0x0000000000bed839 in mongo::(anonymous namespace)::storageValidChildren(mongo::mutablebson::ConstElement const&, bool) ()
      #5129 0x0000000000becb67 in mongo::(anonymous namespace)::storageValid(mongo::mutablebson::ConstElement const&, bool) ()
      #5130 0x0000000000bed839 in mongo::(anonymous namespace)::storageValidChildren(mongo::mutablebson::ConstElement const&, bool) ()
      #5131 0x0000000000becb67 in mongo::(anonymous namespace)::storageValid(mongo::mutablebson::ConstElement const&, bool) ()
      #5132 0x0000000000bed839 in mongo::(anonymous namespace)::storageValidChildren(mongo::mutablebson::ConstElement const&, bool) ()
      #5133 0x0000000000becb67 in mongo::(anonymous namespace)::storageValid(mongo::mutablebson::ConstElement const&, bool) ()
      #5134 0x0000000000bee108 in mongo::(anonymous namespace)::validate(mongo::BSONObj const&, mongo::FieldRefSet const&, mongo::mutablebson::Document const&, std::vector<mongo::FieldRef*, std::allocator<mongo::FieldRef*> > const*, mongo::ModifierInterface::Options const&) ()
      #5135 0x0000000000bef8db in mongo::UpdateStage::transformAndUpdate(mongo::Snapshotted<mongo::BSONObj> const&, mongo::RecordId&) ()
      #5136 0x0000000000bf0938 in mongo::UpdateStage::work(unsigned long*) ()
      #5137 0x0000000000e05f25 in mongo::PlanExecutor::getNextImpl(mongo::Snapshotted<mongo::BSONObj>*, mongo::RecordId*) ()
      #5138 0x0000000000e065e9 in mongo::PlanExecutor::getNext(mongo::BSONObj*, mongo::RecordId*) ()
      #5139 0x0000000000e066e5 in mongo::PlanExecutor::executePlan() ()
      #5140 0x0000000000b66939 in mongo::WriteBatchExecutor::execUpdate(mongo::BatchItemRef const&, mongo::BSONObj*, mongo::WriteErrorDetail**) ()
      

      Attachments

        Issue Links

          Activity

            People

              kyle.suarez@mongodb.com Kyle Suarez
              bruce.lucas@mongodb.com Bruce Lucas
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: