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

Segmentation fault after aggregation with lookup pipeline

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.0.0, 4.0.1
    • Component/s: Aggregation Framework
    • None
    • Environment:
      macOS via docker (docker-for-mac)
    • ALL
    • Hide

      collections:

      db.foo.insertOne({
          _id: ObjectId("5c8a3798083be1395fd18802"),
          refs: [
              ObjectId("5c8f81ecd46a55513395a3e3"),
              ObjectId("5c8f9a40d46a55513395a3e5")
          ]
      })
      
      db.bar.insertMany([
          {
              _id: ObjectId("5c8f81ecd46a55513395a3e3"),
              desc: "first"
          },
          {
              _id: ObjectId("5c8f9a40d46a55513395a3e5"),
              desc: "second"
          }
      ])
      

      query:

      db.foo.aggregate([
          {
              $match: {
                  _id: ObjectId("5c8a3798083be1395fd18802")
              }
          },
          {
              $lookup: {
                  from: "bar",
                  as: "rows",
                  let: {
                      ids: "$refs"
                  },
                  pipeline: [
                      {
                          $match: {
                              $expr: {
                                  $in: ["$_id", "$$ids"]
                              }
                          }
                      },
                      {
                          $sort: { _id: -1 }
                      },
                      {
                          $limit: 5
                      },
                      {
                          $project: {
                              desc: "$desc"
                          }
                      }
                  ]
              }
          }
      ])
      
      Show
      collections: db.foo.insertOne({ _id: ObjectId( "5c8a3798083be1395fd18802" ), refs: [ ObjectId( "5c8f81ecd46a55513395a3e3" ), ObjectId( "5c8f9a40d46a55513395a3e5" ) ] }) db.bar.insertMany([ { _id: ObjectId( "5c8f81ecd46a55513395a3e3" ), desc: "first" }, { _id: ObjectId( "5c8f9a40d46a55513395a3e5" ), desc: "second" } ]) query: db.foo.aggregate([ { $match: { _id: ObjectId( "5c8a3798083be1395fd18802" ) } }, { $lookup: { from: "bar" , as: "rows" , let: { ids: "$refs" }, pipeline: [ { $match: { $expr: { $in: [ "$_id" , "$$ids" ] } } }, { $sort: { _id: -1 } }, { $limit: 5 }, { $project: { desc: "$desc" } } ] } } ])

      II think it was fixed in 4.0.2, but didn't found any related issue, though it would be worth to report it.

      docker images:

      • 4.0.0:sha256:b9a2e733b6d63b2488c6ad14a57b6d80010fea7ca2f8f0790cd4a2f3fc5b6075
      • 4.0.1:sha256:46a78118944a67d14909701c5361483f7c4536e81b31dfea5a891a48d886d26b

      Logs:

      2019-03-19T08:56:21.977+0000 F -        [conn11] Invalid access at address: 0x20
      2019-03-19T08:56:21.999+0000 F -        [conn11] Got signal: 11 (Segmentation fault).
      0x55fec5cdd141 0x55fec5cdc359 0x55fec5cdc9c6 0x7f6fb3997390 0x55fec53075b5 0x55fec531e2cd 0x55fec52d1b8f 0x55fec531e2cd 0x55fec4b19ff5 0x55fec4b1a1ac 0x55fec4b1a6fb 0x55fec4b6b255 0x55fec4b6ba2b 0x55fec48a9581 0x55fec489f874 0x55fec5725c49 0x55fec44076af 0x55fec4409645 0x55fec440bc79 0x55fec440cb21 0x55fec43fa25a 0x55fec4404fba 0x55fec43ffc87 0x55fec4403491 0x55fec558b3a2 0x55fec43fde9f 0x55fec4401035 0x55fec43ff3c7 0x55fec43ffd0d 0x55fec4403491 0x55fec558b905 0x55fec5c37024 0x7f6fb398d6ba 0x7f6fb36c341d
      ----- BEGIN BACKTRACE -----
      {
        "backtrace":[
          {
            "b":"55FEC3965000",
            "o":"2378141",
            "s":"_ZN5mongo15printStackTraceERSo"
          },
          {
            "b":"55FEC3965000",
            "o":"2377359"
          },
          {
            "b":"55FEC3965000",
            "o":"23779C6"
          },
          {
            "b":"7F6FB3986000",
            "o":"11390"
          },
          {
            "b":"55FEC3965000",
            "o":"19A25B5",
            "s":"_ZN5mongo42DocumentSourceSingleDocumentTransformation7getNextEv"
          },
          {
            "b":"55FEC3965000",
            "o":"19B92CD",
            "s":"_ZN5mongo8Pipeline7getNextEv"
          },
          {
            "b":"55FEC3965000",
            "o":"196CB8F",
            "s":"_ZN5mongo20DocumentSourceLookUp7getNextEv"
          },
          {
            "b":"55FEC3965000",
            "o":"19B92CD",
            "s":"_ZN5mongo8Pipeline7getNextEv"
          },
          {
            "b":"55FEC3965000",
            "o":"11B4FF5",
            "s":"_ZN5mongo18PipelineProxyStage11getNextBsonEv"
          },
          {
            "b":"55FEC3965000",
            "o":"11B51AC",
            "s":"_ZN5mongo18PipelineProxyStage6doWorkEPm"
          },
          {
            "b":"55FEC3965000",
            "o":"11B56FB",
            "s":"_ZN5mongo9PlanStage4workEPm"
          },
          {
            "b":"55FEC3965000",
            "o":"1206255",
            "s":"_ZN5mongo12PlanExecutor11getNextImplEPNS_11SnapshottedINS_7BSONObjEEEPNS_8RecordIdE"
          },
          {
            "b":"55FEC3965000",
            "o":"1206A2B",
            "s":"_ZN5mongo12PlanExecutor7getNextEPNS_7BSONObjEPNS_8RecordIdE"
          },
          {
            "b":"55FEC3965000",
            "o":"F44581",
            "s":"_ZN5mongo12runAggregateEPNS_16OperationContextERKNS_15NamespaceStringERKNS_18AggregationRequestERKNS_7BSONObjERNS_14BSONObjBuilderE"
          },
          {
            "b":"55FEC3965000",
            "o":"F3A874"
          },
          {
            "b":"55FEC3965000",
            "o":"1DC0C49",
            "s":"_ZN5mongo12BasicCommand10Invocation3runEPNS_16OperationContextEPNS_19CommandReplyBuilderE"
          },
          {
            "b":"55FEC3965000",
            "o":"AA26AF"
          },
          {
            "b":"55FEC3965000",
            "o":"AA4645"
          },
          {
            "b":"55FEC3965000",
            "o":"AA6C79"
          },
          {
            "b":"55FEC3965000",
            "o":"AA7B21",
            "s":"_ZN5mongo23ServiceEntryPointCommon13handleRequestEPNS_16OperationContextERKNS_7MessageERKNS0_5HooksE"
          },
          {
            "b":"55FEC3965000",
            "o":"A9525A",
            "s":"_ZN5mongo23ServiceEntryPointMongod13handleRequestEPNS_16OperationContextERKNS_7MessageE"
          },
          {
            "b":"55FEC3965000",
            "o":"A9FFBA",
            "s":"_ZN5mongo19ServiceStateMachine15_processMessageENS0_11ThreadGuardE"
          },
          {
            "b":"55FEC3965000",
            "o":"A9AC87",
            "s":"_ZN5mongo19ServiceStateMachine15_runNextInGuardENS0_11ThreadGuardE"
          },
          {
            "b":"55FEC3965000",
            "o":"A9E491"
          },
          {
            "b":"55FEC3965000",
            "o":"1C263A2",
            "s":"_ZN5mongo9transport26ServiceExecutorSynchronous8scheduleESt8functionIFvvEENS0_15ServiceExecutor13ScheduleFlagsENS0_23ServiceExecutorTaskNameE"
          },
          {
            "b":"55FEC3965000",
            "o":"A98E9F",
            "s":"_ZN5mongo19ServiceStateMachine22_scheduleNextWithGuardENS0_11ThreadGuardENS_9transport15ServiceExecutor13ScheduleFlagsENS2_23ServiceExecutorTaskNameENS0_9OwnershipE"
          },
          {
            "b":"55FEC3965000",
            "o":"A9C035",
            "s":"_ZN5mongo19ServiceStateMachine15_sourceCallbackENS_6StatusE"
          },
          {
            "b":"55FEC3965000",
            "o":"A9A3C7",
            "s":"_ZN5mongo19ServiceStateMachine14_sourceMessageENS0_11ThreadGuardE"
          },
          {
            "b":"55FEC3965000",
            "o":"A9AD0D",
            "s":"_ZN5mongo19ServiceStateMachine15_runNextInGuardENS0_11ThreadGuardE"
          },
          {
            "b":"55FEC3965000",
            "o":"A9E491"
          },
          {
            "b":"55FEC3965000",
            "o":"1C26905"
          },
          {
            "b":"55FEC3965000",
            "o":"22D2024"
          },
          {
            "b":"7F6FB3986000",
            "o":"76BA"
          },
          {
            "b":"7F6FB35BC000",
            "o":"10741D",
            "s":"clone"
          }
        ],
        "processInfo":{
          "mongodbVersion":"4.0.0",
          "gitVersion":"3b07af3d4f471ae89e8186d33bbb1d5259597d51",
          "compiledModules":[
      
          ],
          "uname":{
            "sysname":"Linux",
            "release":"4.9.125-linuxkit",
            "version":"#1 SMP Fri Sep 7 08:20:28 UTC 2018",
            "machine":"x86_64"
          },
          "somap":[
            {
              "b":"55FEC3965000",
              "elfType":3,
              "buildId":"365C0577E1D4FD5CD19A9455CB05F9122B9CF331"
            },
            {
              "b":"7FFCDE30E000",
              "elfType":3,
              "buildId":"AA3586244F239D468C9D9083DA99D53FE1408277"
            },
            {
              "b":"7F6FB4D96000",
              "path":"/usr/lib/x86_64-linux-gnu/libcurl.so.4",
              "elfType":3,
              "buildId":"005BC5E1FF6F66E81E9ED22A15EEF9A155EC2FDA"
            },
            {
              "b":"7F6FB4B7B000",
              "path":"/lib/x86_64-linux-gnu/libresolv.so.2",
              "elfType":3,
              "buildId":"6EF73266978476EF9F2FD2CF31E57F4597CB74F8"
            },
            {
              "b":"7F6FB4737000",
              "path":"/lib/x86_64-linux-gnu/libcrypto.so.1.0.0",
              "elfType":3,
              "buildId":"250E875F74377DFC74DE48BF80CCB237BB4EFF1D"
            },
            {
              "b":"7F6FB44CE000",
              "path":"/lib/x86_64-linux-gnu/libssl.so.1.0.0",
              "elfType":3,
              "buildId":"513282AC7EB386E2C0133FD9E1B6B8A0F38B047D"
            },
            {
              "b":"7F6FB42CA000",
              "path":"/lib/x86_64-linux-gnu/libdl.so.2",
              "elfType":3,
              "buildId":"8CC8D0D119B142D839800BFF71FB71E73AEA7BD4"
            },
            {
              "b":"7F6FB40C2000",
              "path":"/lib/x86_64-linux-gnu/librt.so.1",
              "elfType":3,
              "buildId":"89C34D7A182387D76D5CDA1F7718F5D58824DFB3"
            },
            {
              "b":"7F6FB3DB9000",
              "path":"/lib/x86_64-linux-gnu/libm.so.6",
              "elfType":3,
              "buildId":"DFB85DE42DAFFD09640C8FE377D572DE3E168920"
            },
            {
              "b":"7F6FB3BA3000",
              "path":"/lib/x86_64-linux-gnu/libgcc_s.so.1",
              "elfType":3,
              "buildId":"68220AE2C65D65C1B6AAA12FA6765A6EC2F5F434"
            },
            {
              "b":"7F6FB3986000",
              "path":"/lib/x86_64-linux-gnu/libpthread.so.0",
              "elfType":3,
              "buildId":"CE17E023542265FC11D9BC8F534BB4F070493D30"
            },
            {
              "b":"7F6FB35BC000",
              "path":"/lib/x86_64-linux-gnu/libc.so.6",
              "elfType":3,
              "buildId":"B5381A457906D279073822A5CEB24C4BFEF94DDB"
            },
            {
              "b":"7F6FB5005000",
              "path":"/lib64/ld-linux-x86-64.so.2",
              "elfType":3,
              "buildId":"5D7B6259552275A3C17BD4C3FD05F5A6BF40CAA5"
            },
            {
              "b":"7F6FB3389000",
              "path":"/usr/lib/x86_64-linux-gnu/libidn.so.11",
              "elfType":3,
              "buildId":"E09D3783AD1D0BBCD3204FA01E4EF6D756E18F57"
            },
            {
              "b":"7F6FB316D000",
              "path":"/usr/lib/x86_64-linux-gnu/librtmp.so.1",
              "elfType":3,
              "buildId":"8D1CC1204D6B6D33BD1D2C5A2A0516A2234322CF"
            },
            {
              "b":"7F6FB2F23000",
              "path":"/usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2",
              "elfType":3,
              "buildId":"DB5180B568097E2A4690A5B40D36BD134C893FEE"
            },
            {
              "b":"7F6FB2D14000",
              "path":"/usr/lib/x86_64-linux-gnu/liblber-2.4.so.2",
              "elfType":3,
              "buildId":"D3B183C41F02C7CD18F906AAFD19C69C850F1CEB"
            },
            {
              "b":"7F6FB2AC3000",
              "path":"/usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2",
              "elfType":3,
              "buildId":"DA0EC53E16B3AC6BDC56EAEFE1BFECDDC395FB2E"
            },
            {
              "b":"7F6FB28A9000",
              "path":"/lib/x86_64-linux-gnu/libz.so.1",
              "elfType":3,
              "buildId":"8D9BD4CE26E45EF16075C67D5F5EEAFD8B562832"
            },
            {
              "b":"7F6FB2579000",
              "path":"/usr/lib/x86_64-linux-gnu/libgnutls.so.30",
              "elfType":3,
              "buildId":"3CE893F6D1382C2C7648DCCB06E71B1C7E0861CC"
            },
            {
              "b":"7F6FB2346000",
              "path":"/usr/lib/x86_64-linux-gnu/libhogweed.so.4",
              "elfType":3,
              "buildId":"B11678F560199547DCF726384EA39153EE0DFABF"
            },
            {
              "b":"7F6FB2110000",
              "path":"/usr/lib/x86_64-linux-gnu/libnettle.so.6",
              "elfType":3,
              "buildId":"D6B36C5A463EE0FA84FDD6D5FD3F7726EDB90D54"
            },
            {
              "b":"7F6FB1E90000",
              "path":"/usr/lib/x86_64-linux-gnu/libgmp.so.10",
              "elfType":3,
              "buildId":"7B3533D5998D20EE1A1BE3F87789B69041E7F620"
            },
            {
              "b":"7F6FB1BBE000",
              "path":"/usr/lib/x86_64-linux-gnu/libkrb5.so.3",
              "elfType":3,
              "buildId":"16E3DBC6D048145939BB43BBFD7954D27421B00F"
            },
            {
              "b":"7F6FB198F000",
              "path":"/usr/lib/x86_64-linux-gnu/libk5crypto.so.3",
              "elfType":3,
              "buildId":"AEB4C08FC47F86C475E9D3996DFE5E9B403ACEBF"
            },
            {
              "b":"7F6FB178B000",
              "path":"/lib/x86_64-linux-gnu/libcom_err.so.2",
              "elfType":3,
              "buildId":"1E16CB57F699E215A2A8D4EFEF90883BC749B12D"
            },
            {
              "b":"7F6FB1580000",
              "path":"/usr/lib/x86_64-linux-gnu/libkrb5support.so.0",
              "elfType":3,
              "buildId":"DF3219B89E86920E901BAC4A80AA60F2B6134588"
            },
            {
              "b":"7F6FB1365000",
              "path":"/usr/lib/x86_64-linux-gnu/libsasl2.so.2",
              "elfType":3,
              "buildId":"96BCC7EB28D81B1469EED6F24FC083CBD58577BC"
            },
            {
              "b":"7F6FB1124000",
              "path":"/usr/lib/x86_64-linux-gnu/libgssapi.so.3",
              "elfType":3,
              "buildId":"1FE877BE52A424D0636AFD4D35BB330E41D6E0F3"
            },
            {
              "b":"7F6FB0EC0000",
              "path":"/usr/lib/x86_64-linux-gnu/libp11-kit.so.0",
              "elfType":3,
              "buildId":"A0E2D03FF5CF65937F4425D4EFD4D655243809EB"
            },
            {
              "b":"7F6FB0CAD000",
              "path":"/usr/lib/x86_64-linux-gnu/libtasn1.so.6",
              "elfType":3,
              "buildId":"E07E186694852D8F69459C6AB28A53F8DA3CE3B6"
            },
            {
              "b":"7F6FB0AA9000",
              "path":"/lib/x86_64-linux-gnu/libkeyutils.so.1",
              "elfType":3,
              "buildId":"3364D4BF2113C4E8D17EF533867ECC99A53413D6"
            },
            {
              "b":"7F6FB08A0000",
              "path":"/usr/lib/x86_64-linux-gnu/libheimntlm.so.0",
              "elfType":3,
              "buildId":"73A8EADBC85860662B24850E71D4AFBE22C33359"
            },
            {
              "b":"7F6FB0616000",
              "path":"/usr/lib/x86_64-linux-gnu/libkrb5.so.26",
              "elfType":3,
              "buildId":"59E742306A4EA2872E061ECCE92F35FADDA75357"
            },
            {
              "b":"7F6FB0374000",
              "path":"/usr/lib/x86_64-linux-gnu/libasn1.so.8",
              "elfType":3,
              "buildId":"E5C159E415406AE79D21056D752BA949C408B5B1"
            },
            {
              "b":"7F6FB0141000",
              "path":"/usr/lib/x86_64-linux-gnu/libhcrypto.so.4",
              "elfType":3,
              "buildId":"7D15576E1F096614D360784E4A01A1F5FAF908C9"
            },
            {
              "b":"7F6FAFF2B000",
              "path":"/usr/lib/x86_64-linux-gnu/libroken.so.18",
              "elfType":3,
              "buildId":"481DB33C28D88E43DA6BED65E1A7599407D4D818"
            },
            {
              "b":"7F6FAFD23000",
              "path":"/usr/lib/x86_64-linux-gnu/libffi.so.6",
              "elfType":3,
              "buildId":"9D9C958F1F4894AFEF6AECD90D1C430EA29AC34F"
            },
            {
              "b":"7F6FAFAFA000",
              "path":"/usr/lib/x86_64-linux-gnu/libwind.so.0",
              "elfType":3,
              "buildId":"57E25072866B2D30CF02EBE7AE623B84F96FA700"
            },
            {
              "b":"7F6FAF8EB000",
              "path":"/usr/lib/x86_64-linux-gnu/libheimbase.so.1",
              "elfType":3,
              "buildId":"F6F1B4E9F89B716C4A0BA5819BDFFAF4A13EFB91"
            },
            {
              "b":"7F6FAF6A0000",
              "path":"/usr/lib/x86_64-linux-gnu/libhx509.so.5",
              "elfType":3,
              "buildId":"C60082E3BB78D0D42868D9B359B89BF66CE5A1A7"
            },
            {
              "b":"7F6FAF3CB000",
              "path":"/usr/lib/x86_64-linux-gnu/libsqlite3.so.0",
              "elfType":3,
              "buildId":"D9782BA023CAEC26B15D8676E3A5D07B55E121EF"
            },
            {
              "b":"7F6FAF193000",
              "path":"/lib/x86_64-linux-gnu/libcrypt.so.1",
              "elfType":3,
              "buildId":"7BDD51353D50310FFA1587E4AA01B40ABE32D582"
            }
          ]
        }
      }
      mongod(_ZN5mongo15printStackTraceERSo+0x41) [0x55fec5cdd141]
      mongod(+0x2377359) [0x55fec5cdc359]
      mongod(+0x23779C6) [0x55fec5cdc9c6]
      libpthread.so.0(+0x11390) [0x7f6fb3997390]
      mongod(_ZN5mongo42DocumentSourceSingleDocumentTransformation7getNextEv+0x35) [0x55fec53075b5]
      mongod(_ZN5mongo8Pipeline7getNextEv+0x3D) [0x55fec531e2cd]
      mongod(_ZN5mongo20DocumentSourceLookUp7getNextEv+0x12F) [0x55fec52d1b8f]
      mongod(_ZN5mongo8Pipeline7getNextEv+0x3D) [0x55fec531e2cd]
      mongod(_ZN5mongo18PipelineProxyStage11getNextBsonEv+0x35) [0x55fec4b19ff5]
      mongod(_ZN5mongo18PipelineProxyStage6doWorkEPm+0xFC) [0x55fec4b1a1ac]
      mongod(_ZN5mongo9PlanStage4workEPm+0x6B) [0x55fec4b1a6fb]
      mongod(_ZN5mongo12PlanExecutor11getNextImplEPNS_11SnapshottedINS_7BSONObjEEEPNS_8RecordIdE+0x4B5) [0x55fec4b6b255]
      mongod(_ZN5mongo12PlanExecutor7getNextEPNS_7BSONObjEPNS_8RecordIdE+0x4B) [0x55fec4b6ba2b]
      mongod(_ZN5mongo12runAggregateEPNS_16OperationContextERKNS_15NamespaceStringERKNS_18AggregationRequestERKNS_7BSONObjERNS_14BSONObjBuilderE+0x1A91) [0x55fec48a9581]
      mongod(+0xF3A874) [0x55fec489f874]
      mongod(_ZN5mongo12BasicCommand10Invocation3runEPNS_16OperationContextEPNS_19CommandReplyBuilderE+0xD9) [0x55fec5725c49]
      mongod(+0xAA26AF) [0x55fec44076af]
      mongod(+0xAA4645) [0x55fec4409645]
      mongod(+0xAA6C79) [0x55fec440bc79]
      mongod(_ZN5mongo23ServiceEntryPointCommon13handleRequestEPNS_16OperationContextERKNS_7MessageERKNS0_5HooksE+0x331) [0x55fec440cb21]
      mongod(_ZN5mongo23ServiceEntryPointMongod13handleRequestEPNS_16OperationContextERKNS_7MessageE+0x3A) [0x55fec43fa25a]
      mongod(_ZN5mongo19ServiceStateMachine15_processMessageENS0_11ThreadGuardE+0xBA) [0x55fec4404fba]
      mongod(_ZN5mongo19ServiceStateMachine15_runNextInGuardENS0_11ThreadGuardE+0x97) [0x55fec43ffc87]
      mongod(+0xA9E491) [0x55fec4403491]
      mongod(_ZN5mongo9transport26ServiceExecutorSynchronous8scheduleESt8functionIFvvEENS0_15ServiceExecutor13ScheduleFlagsENS0_23ServiceExecutorTaskNameE+0x1A2) [0x55fec558b3a2]
      mongod(_ZN5mongo19ServiceStateMachine22_scheduleNextWithGuardENS0_11ThreadGuardENS_9transport15ServiceExecutor13ScheduleFlagsENS2_23ServiceExecutorTaskNameENS0_9OwnershipE+0x15F) [0x55fec43fde9f]
      mongod(_ZN5mongo19ServiceStateMachine15_sourceCallbackENS_6StatusE+0xAF5) [0x55fec4401035]
      mongod(_ZN5mongo19ServiceStateMachine14_sourceMessageENS0_11ThreadGuardE+0x357) [0x55fec43ff3c7]
      mongod(_ZN5mongo19ServiceStateMachine15_runNextInGuardENS0_11ThreadGuardE+0x11D) [0x55fec43ffd0d]
      mongod(+0xA9E491) [0x55fec4403491]
      mongod(+0x1C26905) [0x55fec558b905]
      mongod(+0x22D2024) [0x55fec5c37024]
      libpthread.so.0(+0x76BA) [0x7f6fb398d6ba]
      libc.so.6(clone+0x6D) [0x7f6fb36c341d]
      -----  END BACKTRACE  -----
      

            Assignee:
            kelsey.schubert@mongodb.com Kelsey Schubert
            Reporter:
            aPoCoMiLogin Filip
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: