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

attempt to return an aggregation result that is too large results in double exceptions and terminate() aborting mongod

    • ALL

      It looks like there is an issue where a BSONObjBuilder is going to grow too large (past the 64mb limit), and an assertion is thrown. Then a BSONObjBuilder gets destroyed, and in this process _done is called which tries to append an EOO to the BSONObj being built. This triggers another assertion about the builder growing too large, which causes the process to terminate.

      Test:

      t = db.t;
      t.drop();
      
      big = new Array( 1000000 ).toString();
      for( i = 0; i < 100; ++i ) {
          t.save( { a:i, b:big } );
      }
      
      t.aggregate( { $sort:{ a:1 } } );
      

      Output:

      Sun Jul  1 22:52:41 [conn2] Assertion: 13548:BufBuilder attempted to grow() to 134217728 bytes, past the 64MB limit.
      0x102131715 0x101ccfe4b 0x101b56a66 0x101b57a47 0x1019588e2 0x101a90f59 0x101b695ac 0x1019bf78a 0x101d43a27 0x1022744a3 0x102274d65 0x101d4177e 0x101a7845a 0x10226b4ca 0x10226c392 0x10226b103 0x101988f5e 0x10198accb 0x10198c120 0x1019cba05 
       0   mongod                              0x0000000102131715 _ZN5mongo15printStackTraceERSo + 37
       1   mongod                              0x0000000101ccfe4b _ZN5mongo10logContextEPKc + 123
       2   mongod                              0x0000000101b56a66 _ZN5mongo11msgassertedEiPKc + 358
       3   mongod                              0x0000000101b57a47 _ZN5mongo11_BufBuilderINS_16TrivialAllocatorEE15grow_reallocateEv + 267
       4   mongod                              0x00000001019588e2 _ZN5mongo11_BufBuilderINS_16TrivialAllocatorEE4growEi + 74
       5   mongod                              0x0000000101a90f59 _ZN5mongo11_BufBuilderINS_16TrivialAllocatorEE9appendBufEPKvm + 41
       6   mongod                              0x0000000101b695ac _ZN5mongo14BSONObjBuilder6appendERKNS_10StringDataEPKci + 140
       7   mongod                              0x00000001019bf78a _ZN5mongo14BSONObjBuilder6appendERKNS_10StringDataERKSs + 74
       8   mongod                              0x0000000101d43a27 _ZN5mongo10BuilderObj6appendESs + 79
       9   mongod                              0x00000001022744a3 _ZNK5mongo5Value9addToBsonEPNS_7BuilderE + 245
       10  mongod                              0x0000000102274d65 _ZNK5mongo5Value12addToBsonObjEPNS_14BSONObjBuilderESs + 95
       11  mongod                              0x0000000101d4177e _ZN5mongo8Document6toBsonEPNS_14BSONObjBuilderE + 174
       12  mongod                              0x0000000101a7845a _ZN5mongo8Pipeline3runERNS_14BSONObjBuilderERSsRKN5boost13intrusive_ptrINS_14DocumentSourceEEE + 1522
       13  mongod                              0x000000010226b4ca _ZN5mongo15PipelineCommand15executePipelineERNS_14BSONObjBuilderERSsRKSsRN5boost13intrusive_ptrINS_8PipelineEEERNS7_INS_20DocumentSourceCursorEEERNS7_INS_17ExpressionContextEEE + 248
       14  mongod                              0x000000010226c392 _ZN5mongo15PipelineCommand10runExecuteERNS_14BSONObjBuilderERSsRKSsS5_RN5boost13intrusive_ptrINS_8PipelineEEERNS7_INS_17ExpressionContextEEE + 664
       15  mongod                              0x000000010226b103 _ZN5mongo15PipelineCommand3runERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb + 515
       16  mongod                              0x0000000101988f5e _ZN5mongo12_execCommandEPNS_7CommandERKSsRNS_7BSONObjEiRNS_14BSONObjBuilderEb + 142
       17  mongod                              0x000000010198accb _ZN5mongo11execCommandEPNS_7CommandERNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb + 4587
       18  mongod                              0x000000010198c120 _ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 1472
       19  mongod                              0x00000001019cba05 _ZN5mongo11runCommandsEPKcRNS_7BSONObjERNS_5CurOpERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 117
      Sun Jul  1 22:52:41 [conn2] Assertion: 13548:BufBuilder attempted to grow() to 134217728 bytes, past the 64MB limit.
      0x102131715 0x101ccfe4b 0x101b56a66 0x101b57a47 0x1019588e2 0x101a39615 0x1019df302 0x101da5c60 0x101a784a9 0x10226b4ca 0x10226c392 0x10226b103 0x101988f5e 0x10198accb 0x10198c120 0x1019cba05 0x1019cc4db 0x10219e362 0x1021a3090 0x101945cb7 
       0   mongod                              0x0000000102131715 _ZN5mongo15printStackTraceERSo + 37
       1   mongod                              0x0000000101ccfe4b _ZN5mongo10logContextEPKc + 123
       2   mongod                              0x0000000101b56a66 _ZN5mongo11msgassertedEiPKc + 358
       3   mongod                              0x0000000101b57a47 _ZN5mongo11_BufBuilderINS_16TrivialAllocatorEE15grow_reallocateEv + 267
       4   mongod                              0x00000001019588e2 _ZN5mongo11_BufBuilderINS_16TrivialAllocatorEE4growEi + 74
       5   mongod                              0x0000000101a39615 _ZN5mongo11_BufBuilderINS_16TrivialAllocatorEE9appendNumEc + 37
       6   mongod                              0x00000001019df302 _ZN5mongo14BSONObjBuilder5_doneEv + 130
       7   mongod                              0x0000000101da5c60 _ZN5mongo14BSONObjBuilderD1Ev + 160
       8   mongod                              0x0000000101a784a9 _ZN5mongo8Pipeline3runERNS_14BSONObjBuilderERSsRKN5boost13intrusive_ptrINS_14DocumentSourceEEE + 1601
       9   mongod                              0x000000010226b4ca _ZN5mongo15PipelineCommand15executePipelineERNS_14BSONObjBuilderERSsRKSsRN5boost13intrusive_ptrINS_8PipelineEEERNS7_INS_20DocumentSourceCursorEEERNS7_INS_17ExpressionContextEEE + 248
       10  mongod                              0x000000010226c392 _ZN5mongo15PipelineCommand10runExecuteERNS_14BSONObjBuilderERSsRKSsS5_RN5boost13intrusive_ptrINS_8PipelineEEERNS7_INS_17ExpressionContextEEE + 664
       11  mongod                              0x000000010226b103 _ZN5mongo15PipelineCommand3runERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb + 515
       12  mongod                              0x0000000101988f5e _ZN5mongo12_execCommandEPNS_7CommandERKSsRNS_7BSONObjEiRNS_14BSONObjBuilderEb + 142
       13  mongod                              0x000000010198accb _ZN5mongo11execCommandEPNS_7CommandERNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb + 4587
       14  mongod                              0x000000010198c120 _ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 1472
       15  mongod                              0x00000001019cba05 _ZN5mongo11runCommandsEPKcRNS_7BSONObjERNS_5CurOpERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 117
       16  mongod                              0x00000001019cc4db _ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ + 1595
       17  mongod                              0x000000010219e362 _ZN5mongoL13receivedQueryERNS_6ClientERNS_10DbResponseERNS_7MessageE + 418
       18  mongod                              0x00000001021a3090 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 1136
       19  mongod                              0x0000000101945cb7 _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 261
      Sun Jul  1 22:52:41 terminate() called, printing stack (if implemented for platform):
      0x102131715 0x101931c1d 0x10436387b 0x101a784cf 0x10226b4ca 0x10226c392 0x10226b103 0x101988f5e 0x10198accb 0x10198c120 0x1019cba05 0x1019cc4db 0x10219e362 0x1021a3090 0x101945cb7 0x101b46123 0x101b479e0 0x101b47a42 0x101b47a6d 0x1020c32e9 
       0   mongod                              0x0000000102131715 _ZN5mongo15printStackTraceERSo + 37
       1   mongod                              0x0000000101931c1d _ZN5mongo11myterminateEv + 173
       2   libstdc++.6.dylib                   0x000000010436387b _ZSt9terminatev + 21
       3   mongod                              0x0000000101a784cf _ZN5mongo8Pipeline3runERNS_14BSONObjBuilderERSsRKN5boost13intrusive_ptrINS_14DocumentSourceEEE + 1639
       4   mongod                              0x000000010226b4ca _ZN5mongo15PipelineCommand15executePipelineERNS_14BSONObjBuilderERSsRKSsRN5boost13intrusive_ptrINS_8PipelineEEERNS7_INS_20DocumentSourceCursorEEERNS7_INS_17ExpressionContextEEE + 248
       5   mongod                              0x000000010226c392 _ZN5mongo15PipelineCommand10runExecuteERNS_14BSONObjBuilderERSsRKSsS5_RN5boost13intrusive_ptrINS_8PipelineEEERNS7_INS_17ExpressionContextEEE + 664
       6   mongod                              0x000000010226b103 _ZN5mongo15PipelineCommand3runERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb + 515
       7   mongod                              0x0000000101988f5e _ZN5mongo12_execCommandEPNS_7CommandERKSsRNS_7BSONObjEiRNS_14BSONObjBuilderEb + 142
       8   mongod                              0x000000010198accb _ZN5mongo11execCommandEPNS_7CommandERNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb + 4587
       9   mongod                              0x000000010198c120 _ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 1472
       10  mongod                              0x00000001019cba05 _ZN5mongo11runCommandsEPKcRNS_7BSONObjERNS_5CurOpERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 117
       11  mongod                              0x00000001019cc4db _ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ + 1595
       12  mongod                              0x000000010219e362 _ZN5mongoL13receivedQueryERNS_6ClientERNS_10DbResponseERNS_7MessageE + 418
       13  mongod                              0x00000001021a3090 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 1136
       14  mongod                              0x0000000101945cb7 _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 261
       15  mongod                              0x0000000101b46123 _ZN5mongo3pms9threadRunEPNS_13MessagingPortE + 2275
       16  mongod                              0x0000000101b479e0 _ZN5boost3_bi5list1INS0_5valueIPN5mongo13MessagingPortEEEEclIPFvS5_ENS0_5list0EEEvNS0_4typeIvEERT_RT0_i + 78
       17  mongod                              0x0000000101b47a42 _ZN5boost3_bi6bind_tIvPFvPN5mongo13MessagingPortEENS0_5list1INS0_5valueIS4_EEEEEclEv + 92
       18  mongod                              0x0000000101b47a6d _ZN5boost6detail11thread_dataINS_3_bi6bind_tIvPFvPN5mongo13MessagingPortEENS2_5list1INS2_5valueIS6_EEEEEEE3runEv + 37
       19  mongod                              0x00000001020c32e9 thread_proxy + 169
      Sun Jul  1 22:52:41 Got signal: 6 (Abort trap: 6).
      
      Sun Jul  1 22:52:41 Backtrace:
      0x102131715 0x1019317ce 0x1045f5cfa 0 0x104594a7a 0x101931c22 0x10436387b 0x101a784cf 0x10226b4ca 0x10226c392 0x10226b103 0x101988f5e 0x10198accb 0x10198c120 0x1019cba05 0x1019cc4db 0x10219e362 0x1021a3090 0x101945cb7 0x101b46123 
       0   mongod                              0x0000000102131715 _ZN5mongo15printStackTraceERSo + 37
       1   mongod                              0x00000001019317ce _ZN5mongo10abruptQuitEi + 446
       2   libsystem_c.dylib                   0x00000001045f5cfa _sigtramp + 26
       3   ???                                 0x0000000000000000 0x0 + 0
       4   libsystem_c.dylib                   0x0000000104594a7a abort + 143
       5   mongod                              0x0000000101931c22 _ZN5mongo11myterminateEv + 178
       6   libstdc++.6.dylib                   0x000000010436387b _ZSt9terminatev + 21
       7   mongod                              0x0000000101a784cf _ZN5mongo8Pipeline3runERNS_14BSONObjBuilderERSsRKN5boost13intrusive_ptrINS_14DocumentSourceEEE + 1639
       8   mongod                              0x000000010226b4ca _ZN5mongo15PipelineCommand15executePipelineERNS_14BSONObjBuilderERSsRKSsRN5boost13intrusive_ptrINS_8PipelineEEERNS7_INS_20DocumentSourceCursorEEERNS7_INS_17ExpressionContextEEE + 248
       9   mongod                              0x000000010226c392 _ZN5mongo15PipelineCommand10runExecuteERNS_14BSONObjBuilderERSsRKSsS5_RN5boost13intrusive_ptrINS_8PipelineEEERNS7_INS_17ExpressionContextEEE + 664
       10  mongod                              0x000000010226b103 _ZN5mongo15PipelineCommand3runERKSsRNS_7BSONObjEiRSsRNS_14BSONObjBuilderEb + 515
       11  mongod                              0x0000000101988f5e _ZN5mongo12_execCommandEPNS_7CommandERKSsRNS_7BSONObjEiRNS_14BSONObjBuilderEb + 142
       12  mongod                              0x000000010198accb _ZN5mongo11execCommandEPNS_7CommandERNS_6ClientEiPKcRNS_7BSONObjERNS_14BSONObjBuilderEb + 4587
       13  mongod                              0x000000010198c120 _ZN5mongo12_runCommandsEPKcRNS_7BSONObjERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 1472
       14  mongod                              0x00000001019cba05 _ZN5mongo11runCommandsEPKcRNS_7BSONObjERNS_5CurOpERNS_11_BufBuilderINS_16TrivialAllocatorEEERNS_14BSONObjBuilderEbi + 117
       15  mongod                              0x00000001019cc4db _ZN5mongo8runQueryERNS_7MessageERNS_12QueryMessageERNS_5CurOpES1_ + 1595
       16  mongod                              0x000000010219e362 _ZN5mongoL13receivedQueryERNS_6ClientERNS_10DbResponseERNS_7MessageE + 418
       17  mongod                              0x00000001021a3090 _ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE + 1136
       18  mongod                              0x0000000101945cb7 _ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE + 261
       19  mongod                              0x0000000101b46123 _ZN5mongo3pms9threadRunEPNS_13MessagingPortE + 2275
      
      

            Assignee:
            matt.dannenberg Matt Dannenberg
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: