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

Exhaust queries broken in shell

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.0-rc5
    • Affects Version/s: 3.6.0-rc3
    • Component/s: None
    • Fully Compatible
    • ALL
    • v3.6
    • Hide

      Run this script in the shell:

      var c = db.largecoll;
      c.drop();
      for (var i = 0; i < 2; i++) {
          assert.writeOK(c.insert({a: i}));
      }
      
      var count = c.find().batchSize(1).itcount();
      print(`${count} documents inserted`);
      var count2 = c.find().batchSize(1).addOption(DBQuery.Option.exhaust).itcount();
      
      Show
      Run this script in the shell: var c = db.largecoll; c.drop(); for ( var i = 0; i < 2; i++) { assert .writeOK(c.insert({a: i})); } var count = c.find().batchSize(1).itcount(); print(`${count} documents inserted`); var count2 = c.find().batchSize(1).addOption(DBQuery.Option.exhaust).itcount();
    • Platforms 2017-11-13, Platforms 2017-12-04
    • 0

      The shell crashes when running an exhaust query:

      2017-11-09T14:17:58.092-0500 I COMMAND  [conn7] query test.largecoll appName: "MongoDB Shell" command: { find: "largecoll", ntoreturn: 2 } planSummary: COLLSCAN cursorid:74606426602 ntoreturn:2 ntoskip:0 exhaust:1 keysExamined:0 docsExamined:2 numYields:0 nreturned:2 reslen:86 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } 0ms
      2017-11-09T14:17:58.092-0500 I COMMAND  [conn7] getmore test.largecoll appName: "MongoDB Shell" command: { getMore: 74606426602, collection: "largecoll", batchSize: 0 } originatingCommand: { find: "largecoll", ntoreturn: 2 } planSummary: COLLSCAN cursorid:74606426602 ntoreturn:0 keysExamined:0 docsExamined:0 cursorExhausted:1 numYields:0 nreturned:0 reslen:20 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } 0ms
      2017-11-09T14:17:58.092-0500 F -        [thread1] Invariant failure !_connectionHasPendingReplies src/mongo/client/dbclientcursor.cpp 207
      2017-11-09T14:17:58.092-0500 F -        [thread1]
      
      ***aborting after invariant() failure
      
      
      2017-11-09T14:17:58.110-0500 F -        [thread1] Got signal: 6 (Aborted).
      
       0x563966026fb1 0x5639660261c9 0x5639660266ad 0x7fb2428bada0 0x7fb2425268a0 0x7fb242527f09 0x56396539695a 0x563965aaa508 0x563965aaa640 0x56396546bde5 0x56396546d06f 0x5639659125eb 0x56396590ded9 0x563965912363 0x563965918e0f 0x563965918f91 0x5639657bfaca 0x5639657bfb70 0x56396547f9f1 0x5639654b1e1f 0x5639654b222f 0x5639654add1c 0x7fb2430e3e20 0x7fb2428b008a 0x7fb2425e824f
      ----- BEGIN BACKTRACE -----
      {"backtrace":[{"b":"563964DD9000","o":"124DFB1","s":"_ZN5mongo15printStackTraceERSo"},{"b":"563964DD9000","o":"124D1C9"},{"b":"563964DD9000","o":"124D6AD"},{"b":"7FB2428A9000","o":"11DA0"},{"b":"7FB2424F2000","o":"348A0","s":"gsignal"},{"b":"7FB2424F2000","o":"35F09","s":"abort"},{"b":"563964DD9000","o":"5BD95A","s":"_ZN5mongo17invariantOKFailedEPKcRKNS_6StatusES1_j"},{"b":"563964DD9000","o":"CD1508","s":"_ZN5mongo14DBClientCursor11requestMoreEv"},{"b":"563964DD9000","o":"CD1640","s":"_ZN5mongo14DBClientCursor4moreEv"},{"b":"563964DD9000","o":"692DE5","s":"_ZN5mongo5mozjs10CursorInfo9Functions7hasNext4callEP9JSContextN2JS8CallArgsE"},{"b":"563964DD9000","o":"69406F","s":"_ZN5mongo5mozjs7smUtils21wrapConstrainedMethodINS0_10CursorInfo9Functions7hasNextELb1EJS3_EEEbP9JSContextjPN2JS5ValueE"},{"b":"563964DD9000","o":"B395EB","s":"_ZN2js6InvokeEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructE"},{"b":"563964DD9000","o":"B34ED9"},{"b":"563964DD9000","o":"B39363","s":"_ZN2js9RunScriptEP9JSContextRNS_8RunStateE"},{"b":"563964DD9000","o":"B3FE0F","s":"_ZN2js13ExecuteKernelEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectRKNS2_5ValueENS_11ExecuteTypeENS_16AbstractFramePtrEPS9_"},{"b":"563964DD9000","o":"B3FF91","s":"_ZN2js7ExecuteEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectPNS2_5ValueE"},{"b":"563964DD9000","o":"9E6ACA"},{"b":"563964DD9000","o":"9E6B70","s":"_Z16JS_ExecuteScriptP9JSContextN2JS6HandleIP8JSScriptEENS1_13MutableHandleINS1_5ValueEEE"},{"b":"563964DD9000","o":"6A69F1","s":"_ZN5mongo5mozjs14MozJSImplScope4execENS_10StringDataERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEbbbi"},{"b":"563964DD9000","o":"6D8E1F"},{"b":"563964DD9000","o":"6D922F","s":"_ZN5mongo5mozjs15MozJSProxyScope10implThreadEPv"},{"b":"563964DD9000","o":"6D4D1C","s":"_ZN4nspr6Thread13ThreadRoutineEPv"},{"b":"7FB24302A000","o":"B9E20"},{"b":"7FB2428A9000","o":"708A"},{"b":"7FB2424F2000","o":"F624F","s":"clone"}],"processInfo":{ "mongodbVersion" : "3.6.0-rc3-47-gf19da233fa", "gitVersion" : "f19da233faba9a42b7fbe84b38df7bb7f1a9e496", "compiledModules" : [ "ninja" ], "uname" : { "sysname" : "Linux", "release" : "4.11.6-3-ARCH", "version" : "#1 SMP PREEMPT Thu Jun 22 12:21:46 CEST 2017", "machine" : "x86_64" }, "somap" : [ { "b" : "563964DD9000", "elfType" : 3, "buildId" : "65F05D3C057D2A158F94404C88330744C1F458B6" }, { "b" : "7FFF93849000", "path" : "linux-vdso.so.1", "elfType" : 3, "buildId" : "12C3AF7B8967019A281ECC0DDEBE02CAC5A841ED" }, { "b" : "7FB243E9F000", "path" : "/usr/lib/libresolv.so.2", "elfType" : 3, "buildId" : "33DAA480FE9C786EF57097475F2FA7F691BEB707" }, { "b" : "7FB243C32000", "path" : "/usr/lib/libssl.so.1.0.0", "elfType" : 3, "buildId" : "0E8B5FA0C5F6C38863B17C011CDFFCE75EC4B6B6" }, { "b" : "7FB2437BD000", "path" : "/usr/lib/libcrypto.so.1.0.0", "elfType" : 3, "buildId" : "63CF2CDD566141A80236BA3D2077CEE5CD538DF8" }, { "b" : "7FB2435B5000", "path" : "/usr/lib/librt.so.1", "elfType" : 3, "buildId" : "668398B7D8B31087A91FF9FF01C982936D347D20" }, { "b" : "7FB2433B1000", "path" : "/usr/lib/libdl.so.2", "elfType" : 3, "buildId" : "CFCD512C5BB2D1B408EF17344C56419803E2F0BA" }, { "b" : "7FB24302A000", "path" : "/usr/lib/libstdc++.so.6", "elfType" : 3, "buildId" : "AB73ECFAC592C274E46F750818EA98C70185F5E6" }, { "b" : "7FB242CDE000", "path" : "/usr/lib/libm.so.6", "elfType" : 3, "buildId" : "2A2E3E2880373D0A505464360EE0E3F279B54CEA" }, { "b" : "7FB242AC7000", "path" : "/usr/lib/libgcc_s.so.1", "elfType" : 3, "buildId" : "CEC5C54C8F0489B399EA2AF044D5561A27BD1C11" }, { "b" : "7FB2428A9000", "path" : "/usr/lib/libpthread.so.0", "elfType" : 3, "buildId" : "60CAE7E4AFD8B276DDFBC85A5A3E7982D59659AA" }, { "b" : "7FB2424F2000", "path" : "/usr/lib/libc.so.6", "elfType" : 3, "buildId" : "F46739D962EC152B56D2BDB7DADAF8E576DBF6EB" }, { "b" : "7FB2440B6000", "path" : "/lib64/ld-linux-x86-64.so.2", "elfType" : 3, "buildId" : "AB968D39D59762A068388224B2CCAFAF2BB72670" } ] }}
       mongo(_ZN5mongo15printStackTraceERSo+0x41) [0x563966026fb1]
       mongo(+0x124D1C9) [0x5639660261c9]
       mongo(+0x124D6AD) [0x5639660266ad]
       libpthread.so.0(+0x11DA0) [0x7fb2428bada0]
       libc.so.6(gsignal+0x110) [0x7fb2425268a0]
       libc.so.6(abort+0x1C9) [0x7fb242527f09]
       mongo(_ZN5mongo17invariantOKFailedEPKcRKNS_6StatusES1_j+0x0) [0x56396539695a]
       mongo(_ZN5mongo14DBClientCursor11requestMoreEv+0x268) [0x563965aaa508]
       mongo(_ZN5mongo14DBClientCursor4moreEv+0x60) [0x563965aaa640]
       mongo(_ZN5mongo5mozjs10CursorInfo9Functions7hasNext4callEP9JSContextN2JS8CallArgsE+0x35) [0x56396546bde5]
       mongo(_ZN5mongo5mozjs7smUtils21wrapConstrainedMethodINS0_10CursorInfo9Functions7hasNextELb1EJS3_EEEbP9JSContextjPN2JS5ValueE+0x1FF) [0x56396546d06f]
       mongo(_ZN2js6InvokeEP9JSContextRKN2JS8CallArgsENS_14MaybeConstructE+0xDB) [0x5639659125eb]
       mongo(+0xB34ED9) [0x56396590ded9]
       mongo(_ZN2js9RunScriptEP9JSContextRNS_8RunStateE+0x113) [0x563965912363]
       mongo(_ZN2js13ExecuteKernelEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectRKNS2_5ValueENS_11ExecuteTypeENS_16AbstractFramePtrEPS9_+0xCF) [0x563965918e0f]
       mongo(_ZN2js7ExecuteEP9JSContextN2JS6HandleIP8JSScriptEER8JSObjectPNS2_5ValueE+0xB1) [0x563965918f91]
       mongo(+0x9E6ACA) [0x5639657bfaca]
       mongo(_Z16JS_ExecuteScriptP9JSContextN2JS6HandleIP8JSScriptEENS1_13MutableHandleINS1_5ValueEEE+0x60) [0x5639657bfb70]
       mongo(_ZN5mongo5mozjs14MozJSImplScope4execENS_10StringDataERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEbbbi+0x181) [0x56396547f9f1]
       mongo(+0x6D8E1F) [0x5639654b1e1f]
       mongo(_ZN5mongo5mozjs15MozJSProxyScope10implThreadEPv+0x14F) [0x5639654b222f]
       mongo(_ZN4nspr6Thread13ThreadRoutineEPv+0x1C) [0x5639654add1c]
       libstdc++.so.6(+0xB9E20) [0x7fb2430e3e20]
       libpthread.so.0(+0x708A) [0x7fb2428b008a]
       libc.so.6(clone+0x3F) [0x7fb2425e824f]
      -----  END BACKTRACE  -----
      

            Assignee:
            jonathan.reams@mongodb.com Jonathan Reams
            Reporter:
            jonathan.reams@mongodb.com Jonathan Reams
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: