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

Ban $changeStream against non-replica set deployments.

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.5.13
    • Affects Version/s: None
    • Component/s: Querying, Replication
    • None
    • Fully Compatible
    • ALL
    • Query 2017-09-11
    • 0

      On a standalone deployment, the oplog collection doesn't exist. Normally, if the collection does not exist, MongoDB will return an empty batch and close the cursor. However, if the client requested batch size of 0, we leave the cursor open, and a subsequent getMore will try to wait for more inserts.

      It doesn't look like this can happen for normal cursors:

      > db.foo.runCommand({find: "foox", tailable: true})
      {
      	"cursor" : {
      		"id" : NumberLong(0),
      		"ns" : "test.foox",
      		"firstBatch" : [ ]
      	},
      	"ok" : 1
      }
      > db.foo.runCommand({find: "foox", tailable: true, batchSize: 0})
      {
      	"cursor" : {
      		"id" : NumberLong(0),
      		"ns" : "test.foox",
      		"firstBatch" : [ ]
      	},
      	"ok" : 1
      }
      

      https://github.com/mongodb/mongo/blob/2730bd049022954bc7cd43392be20e6d54cf330d/src/mongo/db/query/plan_executor.cpp#L227

      Stack trace:

      2017-08-28T17:32:41.095+0000 I COMMAND [conn227] command test.jstests_regexb appName: "MongoDB Shell" command: insert { insert: "jstests_regexb", ordered: true, $db: "test" } ninserted:1 keysInserted:2 numYields:0 reslen:29 locks:{ Global: { acquireCount: { r: 1, w: 1 } }, Database: { acquireCount: { w: 1 } }, Collection: { acquireCount: { w: 1 } } } protocol:op_msg 0ms
      2017-08-28T17:32:41.175+0000 F - [conn227] Invariant failure _yieldPolicy->canReleaseLocksDuringExecution() src/mongo/db/query/plan_executor.cpp 429
      2017-08-28T17:32:41.175+0000 F - [conn227] 
      ***aborting after invariant() failure
       
       
      2017-08-28T17:32:41.196+0000 F - [conn227] Got signal: 6 (Aborted).
       
      0x7fd1d7706841 0x7fd1d7705a59 0x7fd1d7705f3d 0x7fd1d4324850 0x7fd1d3fcb885 0x7fd1d3fcce61 0x7fd1d5ed2920 0x7fd1d656a111 0x7fd1d656add0 0x7fd1d656b75b 0x7fd1d6217ed5 0x7fd1d6218768 0x7fd1d700c368 0x7fd1d65977ad 0x7fd1d65bad57 0x7fd1d6f92ecd 0x7fd1d685a285 0x7fd1d685a47c 0x7fd1d685a973 0x7fd1d656ae1b 0x7fd1d656b75b 0x7fd1d61a7596 0x7fd1d61a926c 0x7fd1d71c8a16 0x7fd1d71c555f 0x7fd1d614ef64 0x7fd1d6150efc 0x7fd1d6151d9e 0x7fd1d615add0 0x7fd1d6157dd2 0x7fd1d6159f07 0x7fd1d61558d1 0x7fd1d75c8b54 0x7fd1d431c806 0x7fd1d407765d
      ----- BEGIN BACKTRACE -----
      {"backtrace":[{"b":"7FD1D55E6000","o":"2120841","s":"_ZN5mongo15printStackTraceERSo"},{"b":"7FD1D55E6000","o":"211FA59"},{"b":"7FD1D55E6000","o":"211FF3D"},{"b":"7FD1D4315000","o":"F850"},{"b":"7FD1D3F99000","o":"32885","s":"gsignal"},{"b":"7FD1D3F99000","o":"33E61","s":"abort"},{"b":"7FD1D55E6000","o":"8EC920","s":"_ZN5mongo17invariantOKFailedEPKcRKNS_6StatusES1_j"},{"b":"7FD1D55E6000","o":"F84111","s":"_ZN5mongo12PlanExecutor20shouldWaitForInsertsEv"},{"b":"7FD1D55E6000","o":"F84DD0","s":"_ZN5mongo12PlanExecutor11getNextImplEPNS_11SnapshottedINS_7BSONObjEEEPNS_8RecordIdE"},{"b":"7FD1D55E6000","o":"F8575B","s":"_ZN5mongo12PlanExecutor7getNextEPNS_7BSONObjEPNS_8RecordIdE"},{"b":"7FD1D55E6000","o":"C31ED5","s":"_ZN5mongo20DocumentSourceCursor9loadBatchEv"},{"b":"7FD1D55E6000","o":"C32768","s":"_ZN5mongo20DocumentSourceCursor7getNextEv"},{"b":"7FD1D55E6000","o":"1A26368","s":"_ZN5mongo42DocumentSourceSingleDocumentTransformation7getNextEv"},{"b":"7FD1D55E6000","o":"FB17AD"},{"b":"7FD1D55E6000","o":"FD4D57","s":"_ZN5mongo35DocumentSourceLookupChangePostImage7getNextEv"},{"b":"7FD1D55E6000","o":"19ACECD","s":"_ZN5mongo8Pipeline7getNextEv"},{"b":"7FD1D55E6000","o":"1274285","s":"_ZN5mongo18PipelineProxyStage11getNextBsonEv"},{"b":"7FD1D55E6000","o":"127447C","s":"_ZN5mongo18PipelineProxyStage6doWorkEPm"},{"b":"7FD1D55E6000","o":"1274973","s":"_ZN5mongo9PlanStage4workEPm"},{"b":"7FD1D55E6000","o":"F84E1B","s":"_ZN5mongo12PlanExecutor11getNextImplEPNS_11SnapshottedINS_7BSONObjEEEPNS_8RecordIdE"},{"b":"7FD1D55E6000","o":"F8575B","s":"_ZN5mongo12PlanExecutor7getNextEPNS_7BSONObjEPNS_8RecordIdE"},{"b":"7FD1D55E6000","o":"BC1596"},{"b":"7FD1D55E6000","o":"BC326C"},{"b":"7FD1D55E6000","o":"1BE2A16","s":"_ZN5mongo12BasicCommand11enhancedRunEPNS_16OperationContextERKNS_12OpMsgRequestERNS_14BSONObjBuilderE"},{"b":"7FD1D55E6000","o":"1BDF55F","s":"_ZN5mongo7Command9publicRunEPNS_16OperationContextERKNS_12OpMsgRequestERNS_14BSONObjBuilderE"},{"b":"7FD1D55E6000","o":"B68F64"},{"b":"7FD1D55E6000","o":"B6AEFC"},{"b":"7FD1D55E6000","o":"B6BD9E","s":"_ZN5mongo23ServiceEntryPointMongod13handleRequestEPNS_16OperationContextERKNS_7MessageE"},{"b":"7FD1D55E6000","o":"B74DD0","s":"_ZN5mongo19ServiceStateMachine15_processMessageERNS0_11ThreadGuardE"},{"b":"7FD1D55E6000","o":"B71DD2","s":"_ZN5mongo19ServiceStateMachine15_runNextInGuardERNS0_11ThreadGuardE"},{"b":"7FD1D55E6000","o":"B73F07","s":"_ZN5mongo19ServiceStateMachine7runNextEv"},{"b":"7FD1D55E6000","o":"B6F8D1"},{"b":"7FD1D55E6000","o":"1FE2B54"},{"b":"7FD1D4315000","o":"7806"},{"b":"7FD1D3F99000","o":"DE65D","s":"clone"}],"processInfo":{ "mongodbVersion" : "3.5.12-81-g55a85da", "gitVersion" : "55a85da4980f1967f88bbccbd43646ee89c6301f", "compiledModules" : [], "uname" : { "sysname" : "Linux", "release" : "3.0.101-65-ec2", "version" : "#1 SMP Mon Sep 7 19:21:52 UTC 2015 (bef9feb)", "machine" : "x86_64" }, "somap" : [ { "b" : "7FD1D55E6000", "elfType" : 3, "buildId" : "16A7974105B78C63336290B07347B78E450FCFE6" }, { "b" : "7FFDB586A000", "elfType" : 3, "buildId" : "99C22E108F9AF52BB22FAAE27B62BEEE6AF1FFEF" }, { "b" : "7FD1D516E000", "path" : "/usr/lib64/libssl.so.0.9.8", "elfType" : 3, "buildId" : "F303AF2DC415D507812C74A220858FFB808043FF" }, { "b" : "7FD1D4DCF000", "path" : "/usr/lib64/libcrypto.so.0.9.8", "elfType" : 3, "buildId" : "CE8025EA3EB87B82EB5784D1599DF6BA9AFDAA89" }, { "b" : "7FD1D4BC6000", "path" : "/lib64/librt.so.1", "elfType" : 3, "buildId" : "56683208E69F23CE2B85AA69224347494B2D9B19" }, { "b" : "7FD1D49C2000", "path" : "/lib64/libdl.so.2", "elfType" : 3, "buildId" : "9A1CAA796142646BAB3852E16F39FE12F9570C73" }, { "b" : "7FD1D4749000", "path" : "/lib64/libm.so.6", "elfType" : 3, "buildId" : "C23AC6F6F615C8711D27A85E3D4DDDDE2DC32B56" }, { "b" : "7FD1D4532000", "path" : "/lib64/libgcc_s.so.1", "elfType" : 3, "buildId" : "EC0B843677D80C0216B976F17E8022790C578DCD" }, { "b" : "7FD1D4315000", "path" : "/lib64/libpthread.so.0", "elfType" : 3, "buildId" : "796CFD89EFAA4BB7EFD2A26590698F2ED0613E76" }, { "b" : "7FD1D3F99000", "path" : "/lib64/libc.so.6", "elfType" : 3, "buildId" : "D00CEF910068265D1DBF11F6116FE44EDA290FBC" }, { "b" : "7FD1D53C4000", "path" : "/lib64/ld-linux-x86-64.so.2", "elfType" : 3, "buildId" : "83058B5E06B2DBEB7ECAD4DBA132503F4E55E143" }, { "b" : "7FD1D3D83000", "path" : "/lib64/libz.so.1", "elfType" : 3, "buildId" : "C96D4398CB0A4F35E94CE172F9536CD5EBD20DD6" } ] }}
      mongod(_ZN5mongo15printStackTraceERSo+0x41) [0x7fd1d7706841]
      mongod(+0x211FA59) [0x7fd1d7705a59]
      mongod(+0x211FF3D) [0x7fd1d7705f3d]
      libpthread.so.0(+0xF850) [0x7fd1d4324850]
      libc.so.6(gsignal+0x35) [0x7fd1d3fcb885]
      libc.so.6(abort+0x181) [0x7fd1d3fcce61]
      mongod(_ZN5mongo17invariantOKFailedEPKcRKNS_6StatusES1_j+0x0) [0x7fd1d5ed2920]
      mongod(_ZN5mongo12PlanExecutor20shouldWaitForInsertsEv+0x111) [0x7fd1d656a111]
      mongod(_ZN5mongo12PlanExecutor11getNextImplEPNS_11SnapshottedINS_7BSONObjEEEPNS_8RecordIdE+0x390) [0x7fd1d656add0]
      mongod(_ZN5mongo12PlanExecutor7getNextEPNS_7BSONObjEPNS_8RecordIdE+0x4B) [0x7fd1d656b75b]
      mongod(_ZN5mongo20DocumentSourceCursor9loadBatchEv+0xE5) [0x7fd1d6217ed5]
      mongod(_ZN5mongo20DocumentSourceCursor7getNextEv+0x88) [0x7fd1d6218768]
      mongod(_ZN5mongo42DocumentSourceSingleDocumentTransformation7getNextEv+0x38) [0x7fd1d700c368]
      mongod(+0xFB17AD) [0x7fd1d65977ad]
      mongod(_ZN5mongo35DocumentSourceLookupChangePostImage7getNextEv+0x47) [0x7fd1d65bad57]
      mongod(_ZN5mongo8Pipeline7getNextEv+0x3D) [0x7fd1d6f92ecd]
      mongod(_ZN5mongo18PipelineProxyStage11getNextBsonEv+0x35) [0x7fd1d685a285]
      mongod(_ZN5mongo18PipelineProxyStage6doWorkEPm+0x11C) [0x7fd1d685a47c]
      mongod(_ZN5mongo9PlanStage4workEPm+0x63) [0x7fd1d685a973]
      mongod(_ZN5mongo12PlanExecutor11getNextImplEPNS_11SnapshottedINS_7BSONObjEEEPNS_8RecordIdE+0x3DB) [0x7fd1d656ae1b]
      mongod(_ZN5mongo12PlanExecutor7getNextEPNS_7BSONObjEPNS_8RecordIdE+0x4B) [0x7fd1d656b75b]
      mongod(+0xBC1596) [0x7fd1d61a7596]
      mongod(+0xBC326C) [0x7fd1d61a926c]
      mongod(_ZN5mongo12BasicCommand11enhancedRunEPNS_16OperationContextERKNS_12OpMsgRequestERNS_14BSONObjBuilderE+0x76) [0x7fd1d71c8a16]
      mongod(_ZN5mongo7Command9publicRunEPNS_16OperationContextERKNS_12OpMsgRequestERNS_14BSONObjBuilderE+0x1F) [0x7fd1d71c555f]
      mongod(+0xB68F64) [0x7fd1d614ef64]
      mongod(+0xB6AEFC) [0x7fd1d6150efc]
      mongod(_ZN5mongo23ServiceEntryPointMongod13handleRequestEPNS_16OperationContextERKNS_7MessageE+0x2FE) [0x7fd1d6151d9e]
      mongod(_ZN5mongo19ServiceStateMachine15_processMessageERNS0_11ThreadGuardE+0xF0) [0x7fd1d615add0]
      mongod(_ZN5mongo19ServiceStateMachine15_runNextInGuardERNS0_11ThreadGuardE+0x1B2) [0x7fd1d6157dd2]
      mongod(_ZN5mongo19ServiceStateMachine7runNextEv+0x157) [0x7fd1d6159f07]
      mongod(+0xB6F8D1) [0x7fd1d61558d1]
      mongod(+0x1FE2B54) [0x7fd1d75c8b54]
      libpthread.so.0(+0x7806) [0x7fd1d431c806]
      libc.so.6(clone+0x6D) [0x7fd1d407765d]
      -----  END BACKTRACE  -----
      mongod on port 20000 was expected to be running in _do_teardown(), but wasn't. Exited with code -6.
      

            Assignee:
            charlie.swanson@mongodb.com Charlie Swanson
            Reporter:
            justin.seyster@mongodb.com Justin Seyster
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: