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

Need better messaging in BSONElement::chk() errors

    • Fully Compatible
    • Platforms 2017-06-19, Platforms 2017-07-10, Platforms 2017-07-31, Platforms 2017-08-21

      Original Title: mongod becomes very mad when passing wrong type for aggregate explain

      Note: this is not an agg specific issue, but this is an example triggering the issue using agg.

      db.runCommand({aggregate: "foo", pipeline: [], explain: 1})
      

      returns

      {
      	"errmsg" : "exception: wrong type for field (explain) 1 != 8",
      	"code" : 13111,
      	"ok" : 0
      }
      

      Where I would have expected (like allowDiskUse does in same situation)

      ..
      	"errmsg" : "exception: explain must be a bool, not a NumberDouble",
      

      Furthermore, mongod becomes very mad in the logs:

      2014-03-26T13:14:16.130-0700 [conn3] Assertion: 13111:wrong type for field (explain) 1 != 8
      2014-03-26T13:14:16.134-0700 [conn3] 0x1006d60ab 0x10068a7a2 0x10067af4f 0x10067b02d 0x1000e29d0 0x1003c6624 0x10016d399 0x1001bb6f5 0x1001bc1f1 0x1001bd16c 0x1003fd43f 0x1002a2790 0x100007ac4 0x100698171 0x10070ae35 0x7fff88a01772 0x7fff889ee1a1
       0   mongod                              0x00000001006d60ab _ZN5mongo15printStackTraceERSo + 43
       1   mongod                              0x000000010068a7a2 _ZN5mongo10logContextEPKc + 114
       2   mongod                              0x000000010067af4f _ZN5mongo11msgassertedEiPKc + 255
       3   mongod                              0x000000010067b02d _ZN5mongo11msgassertedEiRKSs + 29
       4   mongod                              0x00000001000e29d0 _ZNK5mongo11BSONElement3chkEi + 800
       5   mongod                              0x00000001003c6624 _ZN5mongo8Pipeline12parseCommandERSsRKNS_7BSONObjERKN5boost13intrusive_ptrINS_17ExpressionContextEEE + 724
       6   mongod                              0x000000010016d399 _ZN5mongo15PipelineCommand3runERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb + 445
       7   mongod                              0x00000001001bb6f5 _ZN5mongo12_execCommandEPNS_7CommandERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb + 37
       8   mongod                              0x00000001001bc1f1 _ZN5mongo7Command11execCommandEPS0_RNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb + 2245
       9   mongod                              0x00000001001bd16c _ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 1388
       10  mongod                              0x00000001003fd43f _ZN5mongo11newRunQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ + 1615
       11  mongod                              0x00000001002a2790 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 1968
       12  mongod                              0x0000000100007ac4 _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 308
       13  mongod                              0x0000000100698171 _ZN5mongo17PortMessageServer17handleIncomingMsgEPv + 1681
       14  mongod                              0x000000010070ae35 thread_proxy + 229
       15  libsystem_c.dylib                   0x00007fff88a01772 _pthread_start + 327
       16  libsystem_c.dylib                   0x00007fff889ee1a1 thread_start + 13
      

            Assignee:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Reporter:
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: