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

Accessing cursor with pending data after renaming collection may trigger fassert

    • Fully Compatible
    • ALL
    • v3.4, v3.2, v3.0
    • Hide

      The following sequence of commands are inspired by the SERVER-24963 test case:

          let collName = 'system_indexes_invalidations';
          let coll = db[collName];
          coll.drop();
          assert.commandWorked(coll.createIndexes([{a: 1}, {b: 1}, {c: 1}]));
          let cmd = db.system.indexes.count() ? {find: 'system.indexes'} : {listIndexes: collName};
          Object.extend(cmd, {batchSize: 2});
          let res = db.runCommand(cmd);
          assert.commandWorked(res, 'could not run ' + tojson(cmd));
          printjson(res);
          let cursor = new DBCommandCursor(db.getMongo(), res);
          let errMsg = 'expected more data from command ' + tojson(cmd) + ', with result ' + tojson(res);
          assert(cursor.hasNext(), errMsg);
          coll.renameCollection('renamed_collection');
          assert.gt(cursor.itcount(), 0, errMsg);
      
      Show
      The following sequence of commands are inspired by the SERVER-24963 test case: let collName = 'system_indexes_invalidations' ; let coll = db[collName]; coll.drop(); assert.commandWorked(coll.createIndexes([{a: 1}, {b: 1}, {c: 1}])); let cmd = db.system.indexes.count() ? {find: 'system.indexes' } : {listIndexes: collName}; Object .extend(cmd, {batchSize: 2}); let res = db.runCommand(cmd); assert.commandWorked(res, 'could not run ' + tojson(cmd)); printjson(res); let cursor = new DBCommandCursor(db.getMongo(), res); let errMsg = 'expected more data from command ' + tojson(cmd) + ', with result ' + tojson(res); assert(cursor.hasNext(), errMsg); coll.renameCollection( 'renamed_collection' ); assert.gt(cursor.itcount(), 0, errMsg);
    • Storage 2017-02-13

      Similar to SERVER-24963 and an example of a direct call to deleteRecord as described in SERVER-27199, we do not invalidate old index record IDs when we rename a collection for mmapv1. Using a cursor that attempts to access these old record IDs thus may trigger an fassert.
      Backtrace:

      [MongoDFixture:job0] 2017-02-06T17:52:18.590-0500 I -        [conn4] Fatal Assertion 17441 at src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp 282
      [MongoDFixture:job0] 2017-02-06T17:52:18.590-0500 I -        [conn4]
      [MongoDFixture:job0]
      [MongoDFixture:job0] ***aborting after fassert() failure
      [MongoDFixture:job0]
      [MongoDFixture:job0]
      [MongoDFixture:job0] 2017-02-06T17:52:18.610-0500 F -        [conn4] Got signal: 6 (Aborted).
      [MongoDFixture:job0]
      [MongoDFixture:job0]  0x55b2e0dd4fd1 0x55b2e0dd40c9 0x55b2e0dd45ad 0x7f9ba2f5a390 0x7f9ba2bb5428 0x7f9ba2bb702a 0x55b2e005a1ab 0x55b2e0aa8456 0x55b2e0aa8485 0x55b2e0abd13d 0x55b2e0abd1ae 0x55b2e03daf65 0x55b2e0409d03 0x55b2e071341a 0x55b2e0713d3b 0x55b2e0303290 0x55b2e0304679 0x55b2e0306636 0x55b2e02c4067 0x55b2e02c5453 0x55b2e029366c 0x55b2e08f5a6d 0x55b2e01ba33c 0x55b2e00c5d3d 0x55b2e00c667d 0x55b2e0d52442 0x7f9ba2f506ba 0x7f9ba2c8682d
      [MongoDFixture:job0] ----- BEGIN BACKTRACE -----
      [MongoDFixture:job0] {"backtrace":[{"b":"55B2DF896000","o":"153EFD1","s":"_ZN5mongo15printStackTraceERSo"},{"b":"55B2DF896000","o":"153E0C9"},{"b":"55B2DF896000","o":"153E5AD"},{"b":"7F9BA2F49000","o":"11390"},{"b":"7F9BA2B80000","o":"35428","s":"gsignal"},{"b":"7F9BA2B80000","o":"3702A","s":"abort"},{"b":"55B2DF896000","o":"7C41AB","s":"_ZN5mongo32fassertFailedNoTraceWithLocationEiPKcj"},{"b":"55B2DF896000","o":"1212456"},{"b":"55B2DF896000","o":"1212485","s":"_ZNK5mongo17RecordStoreV1Base13getNextRecordEPNS_16OperationContextERKNS_7DiskLocE"},{"b":"55B2DF896000","o":"122713D","s":"_ZN5mongo27SimpleRecordStoreV1Iterator7advanceEv"},{"b":"55B2DF896000","o":"12271AE","s":"_ZN5mongo27SimpleRecordStoreV1Iterator4nextEv"},{"b":"55B2DF896000","o":"B44F65","s":"_ZN5mongo14CollectionScan6doWorkEPm"},{"b":"55B2DF896000","o":"B73D03","s":"_ZN5mongo9PlanStage4workEPm"},{"b":"55B2DF896000","o":"E7D41A","s":"_ZN5mongo12PlanExecutor11getNextImplEPNS_11SnapshottedINS_7BSONObjEEEPNS_8RecordIdE"},{"b":"55B2DF896000","o":"E7DD3B","s":"_ZN5mongo12PlanExecutor7getNextEPNS_7BSONObjEPNS_8RecordIdE"},{"b":"55B2DF896000","o":"A6D290","s":"_ZN5mongo10GetMoreCmd13generateBatchEPNS_12ClientCursorERKNS_14GetMoreRequestEPNS_21CursorResponseBuilderEPNS_12PlanExecutor9ExecStateEPx"},{"b":"55B2DF896000","o":"A6E679","s":"_ZN5mongo10GetMoreCmd9runParsedEPNS_16OperationContextERKNS_15NamespaceStringERKNS_14GetMoreRequestERNS_7BSONObjERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_14BSONObjBuilderE"},{"b":"55B2DF896000","o":"A70636","s":"_ZN5mongo10GetMoreCmd3runEPNS_16OperationContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_7BSONObjEiRS8_RNS_14BSONObjBuilderE"},{"b":"55B2DF896000","o":"A2E067","s":"_ZN5mongo7Command3runEPNS_16OperationContextERKNS_3rpc16RequestInterfaceEPNS3_21ReplyBuilderInterfaceE"},{"b":"55B2DF896000","o":"A2F453","s":"_ZN5mongo19execCommandDatabaseEPNS_16OperationContextEPNS_7CommandERKNS_3rpc16RequestInterfaceEPNS4_21ReplyBuilderInterfaceE"},{"b":"55B2DF896000","o":"9FD66C","s":"_ZN5mongo7Command11execCommandEPNS_16OperationContextEPS0_RKNS_3rpc16RequestInterfaceEPNS4_21ReplyBuilderInterfaceE"},{"b":"55B2DF896000","o":"105FA6D","s":"_ZN5mongo11runCommandsEPNS_16OperationContextERKNS_3rpc16RequestInterfaceEPNS2_21ReplyBuilderInterfaceE"},{"b":"55B2DF896000","o":"92433C","s":"_ZN5mongo16assembleResponseEPNS_16OperationContextERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE"},{"b":"55B2DF896000","o":"82FD3D","s":"_ZN5mongo23ServiceEntryPointMongod12_sessionLoopERKSt10shared_ptrINS_9transport7SessionEE"},{"b":"55B2DF896000","o":"83067D"},{"b":"55B2DF896000","o":"14BC442"},{"b":"7F9BA2F49000","o":"76BA"},{"b":"7F9BA2B80000","o":"10682D","s":"clone"}],"processInfo":{ "mongodbVersion" : "3.5.2-32-gfd56faf", "gitVersion" : "fd56faf537571f9bad868deba1d778d9b85fe18c", "compiledModules" : [], "uname" : { "sysname" : "Linux", "release" : "4.4.0-59-generic", "version" : "#80-Ubuntu SMP Fri Jan 6 17:47:47 UTC 2017", "machine" : "x86_64" }, "somap" : [ { "b" : "55B2DF896000", "elfType" : 3, "buildId" : "7C0C9A8E3B5590C779DEA71DC50CFE547122717A" }, { "b" : "7FFC175E2000", "elfType" : 3, "buildId" : "98C85DCFE56E7660F524C68B12686945F8F8C973" }, { "b" : "7F9BA3C0B000", "path" : "/lib/x86_64-linux-gnu/librt.so.1", "elfType" : 3, "buildId" : "A656E8087D6226AE46A173477B8B8E0767D559D9" }, { "b" : "7F9BA3A07000", "path" : "/lib/x86_64-linux-gnu/libdl.so.2", "elfType" : 3, "buildId" : "AFDCB9B3774F5AFE6EB3EC9A76A8BA159A17D5B6" }, { "b" : "7F9BA3685000", "path" : "/usr/lib/x86_64-linux-gnu/libstdc++.so.6", "elfType" : 3, "buildId" : "144E588F94CAFAFDBD0BD1499C74190F678DAD88" }, { "b" : "7F9BA337C000", "path" : "/lib/x86_64-linux-gnu/libm.so.6", "elfType" : 3, "buildId" : "4DBE0469DACBA00586428C9C7F4BBCEC8B6B1489" }, { "b" : "7F9BA3166000", "path" : "/lib/x86_64-linux-gnu/libgcc_s.so.1", "elfType" : 3, "buildId" : "68220AE2C65D65C1B6AAA12FA6765A6EC2F5F434" }, { "b" : "7F9BA2F49000", "path" : "/lib/x86_64-linux-gnu/libpthread.so.0", "elfType" : 3, "buildId" : "4D7F52F335DC9665C2DCF308CE6514A6AE86DEDE" }, { "b" : "7F9BA2B80000", "path" : "/lib/x86_64-linux-gnu/libc.so.6", "elfType" : 3, "buildId" : "60131540DADC6796CAB33388349E6E4E68692053" }, { "b" : "7F9BA3E13000", "path" : "/lib64/ld-linux-x86-64.so.2", "elfType" : 3, "buildId" : "EA8652B03788783033C3AF093DFB71509C1378F8" } ] }}
      [MongoDFixture:job0]  mongod(_ZN5mongo15printStackTraceERSo+0x41) [0x55b2e0dd4fd1]
      [MongoDFixture:job0]  mongod(+0x153E0C9) [0x55b2e0dd40c9]
      [MongoDFixture:job0]  mongod(+0x153E5AD) [0x55b2e0dd45ad]
      [MongoDFixture:job0]  libpthread.so.0(+0x11390) [0x7f9ba2f5a390]
      [MongoDFixture:job0]  libc.so.6(gsignal+0x38) [0x7f9ba2bb5428]
      [MongoDFixture:job0]  libc.so.6(abort+0x16A) [0x7f9ba2bb702a]
      [MongoDFixture:job0]  mongod(_ZN5mongo32fassertFailedNoTraceWithLocationEiPKcj+0x0) [0x55b2e005a1ab]
      [MongoDFixture:job0]  mongod(+0x1212456) [0x55b2e0aa8456]
      [MongoDFixture:job0]  mongod(_ZNK5mongo17RecordStoreV1Base13getNextRecordEPNS_16OperationContextERKNS_7DiskLocE+0x25) [0x55b2e0aa8485]
      [MongoDFixture:job0]  mongod(_ZN5mongo27SimpleRecordStoreV1Iterator7advanceEv+0x3D) [0x55b2e0abd13d]
      [MongoDFixture:job0]  mongod(_ZN5mongo27SimpleRecordStoreV1Iterator4nextEv+0x5E) [0x55b2e0abd1ae]
      [MongoDFixture:job0]  mongod(_ZN5mongo14CollectionScan6doWorkEPm+0xC5) [0x55b2e03daf65]
      [MongoDFixture:job0]  mongod(_ZN5mongo9PlanStage4workEPm+0x63) [0x55b2e0409d03]
      [MongoDFixture:job0]  mongod(_ZN5mongo12PlanExecutor11getNextImplEPNS_11SnapshottedINS_7BSONObjEEEPNS_8RecordIdE+0x19A) [0x55b2e071341a]
      [MongoDFixture:job0]  mongod(_ZN5mongo12PlanExecutor7getNextEPNS_7BSONObjEPNS_8RecordIdE+0x4B) [0x55b2e0713d3b]
      [MongoDFixture:job0]  mongod(_ZN5mongo10GetMoreCmd13generateBatchEPNS_12ClientCursorERKNS_14GetMoreRequestEPNS_21CursorResponseBuilderEPNS_12PlanExecutor9ExecStateEPx+0xC0) [0x55b2e0303290]
      [MongoDFixture:job0]  mongod(_ZN5mongo10GetMoreCmd9runParsedEPNS_16OperationContextERKNS_15NamespaceStringERKNS_14GetMoreRequestERNS_7BSONObjERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_14BSONObjBuilderE+0xB89) [0x55b2e0304679]
      [MongoDFixture:job0]  mongod(_ZN5mongo10GetMoreCmd3runEPNS_16OperationContextERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERNS_7BSONObjEiRS8_RNS_14BSONObjBuilderE+0x206) [0x55b2e0306636]
      [MongoDFixture:job0]  mongod(_ZN5mongo7Command3runEPNS_16OperationContextERKNS_3rpc16RequestInterfaceEPNS3_21ReplyBuilderInterfaceE+0x527) [0x55b2e02c4067]
      [MongoDFixture:job0]  mongod(_ZN5mongo19execCommandDatabaseEPNS_16OperationContextEPNS_7CommandERKNS_3rpc16RequestInterfaceEPNS4_21ReplyBuilderInterfaceE+0xA13) [0x55b2e02c5453]
      [MongoDFixture:job0]  mongod(_ZN5mongo7Command11execCommandEPNS_16OperationContextEPS0_RKNS_3rpc16RequestInterfaceEPNS4_21ReplyBuilderInterfaceE+0x4C) [0x55b2e029366c]
      [MongoDFixture:job0]  mongod(_ZN5mongo11runCommandsEPNS_16OperationContextERKNS_3rpc16RequestInterfaceEPNS2_21ReplyBuilderInterfaceE+0x26D) [0x55b2e08f5a6d]
      [MongoDFixture:job0]  mongod(_ZN5mongo16assembleResponseEPNS_16OperationContextERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0xC9C) [0x55b2e01ba33c]
      [MongoDFixture:job0]  mongod(_ZN5mongo23ServiceEntryPointMongod12_sessionLoopERKSt10shared_ptrINS_9transport7SessionEE+0x1ED) [0x55b2e00c5d3d]
      [MongoDFixture:job0]  mongod(+0x83067D) [0x55b2e00c667d]
      [MongoDFixture:job0]  mongod(+0x14BC442) [0x55b2e0d52442]
      [MongoDFixture:job0]  libpthread.so.0(+0x76BA) [0x7f9ba2f506ba]
      [MongoDFixture:job0]  libc.so.6(clone+0x6D) [0x7f9ba2c8682d]
      [MongoDFixture:job0] -----  END BACKTRACE  -----
      

            Assignee:
            maria.vankeulen@mongodb.com Maria van Keulen
            Reporter:
            maria.vankeulen@mongodb.com Maria van Keulen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: