Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-464

allocation failure in for loop

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.6.1
    • Affects Version/s: 0.5.2
    • Component/s: CRUD
    • Labels:
      None
    • Environment:
      macOS Catalina (10.15.6)
      32GB RAM
    • Not Needed
    • Iteration Quince

      Problem Description

      Tried to insert 1,000,000 small docs In an empty standalone mongod.

      Steps to Reproduce

      for (i=0;i<1000000;i++){db.foo.insert({x:i, y: "asdfasdfasdfasdfasdfasdf"})}
        

      Expected Results

      Insert 1,000,000 docs

      Actual Results

      mongosh aborts after inserting 684,930 docs

      > for (i=0;i<1000000;i++){db.foo.insert({x:i, y: "asdfasdfasdfasdfasdfasdf"})}<--- Last few GCs --->[50954:0x108008000]   283358 ms: Scavenge 2028.4 (2049.9) -> 2027.6 (2050.6) MB, 5.0 / 0.0 ms  (average mu = 0.177, current mu = 0.011) allocation failure
      [50954:0x108008000]   284472 ms: Mark-sweep 2028.5 (2050.6) -> 2027.4 (2049.9) MB, 1100.9 / 0.2 ms  (average mu = 0.121, current mu = 0.031) allocation failure scavenge might not succeed
      [50954:0x108008000]   284603 ms: Scavenge 2028.5 (2050.1) -> 2027.6 (2050.6) MB, 4.9 / 0.0 ms  (average mu = 0.121, current mu = 0.031) allocation failure
      <--- JS stacktrace --->==== JS stack trace =========================================    0: ExitFrame [pc: 0x100797639]
      Security context: 0x281640b008d1 <JSObject>
          1: filter [0x281640b15df9](this=0x281607c53cd1 <JSArray[1]>,0x281607c53d09 <JSFunction (sfi = 0x281663447a91)>)
          2: lastIsMaster [0x28169e8bd6c1] [/usr/local/Cellar/mongosh/0.5.2/libexec/lib/node_modules/@mongosh/cli-repl/node_modules/mongodb/lib/core/sdam/topology.js:752] [bytecode=0x281663447b81 offset=69](this=0x2816e6bdea81 <EventEmitter map = 0x2816...FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
       1: 0x100095531 node::Abort() [/usr/local/opt/node@12/bin/node]
       2: 0x1000956a7 node::OnFatalError(char const*, char const*) [/usr/local/opt/node@12/bin/node]
       3: 0x1001a46b5 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/usr/local/opt/node@12/bin/node]
       4: 0x1001a465f v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/usr/local/opt/node@12/bin/node]
       5: 0x1002cf5a9 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/usr/local/opt/node@12/bin/node]
       6: 0x1002d0928 v8::internal::Heap::MarkCompactPrologue() [/usr/local/opt/node@12/bin/node]
       7: 0x1002ce439 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/usr/local/opt/node@12/bin/node]
       8: 0x1002ccd73 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/usr/local/opt/node@12/bin/node]
       9: 0x1002d496e v8::internal::Heap::AllocateRawWithLightRetry(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/opt/node@12/bin/node]
      10: 0x1002d49c6 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/usr/local/opt/node@12/bin/node]
      11: 0x1002b2178 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/usr/local/opt/node@12/bin/node]
      12: 0x100513c18 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/usr/local/opt/node@12/bin/node]
      13: 0x100797639 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_NoBuiltinExit [/usr/local/opt/node@12/bin/node]
      14: 0x1007a6c63 Builtins_ArrayFilter [/usr/local/opt/node@12/bin/node]
      15: 0x10071cec4 Builtins_InterpreterEntryTrampoline [/usr/local/opt/node@12/bin/node]
      Abort trap: 6 

      Additional Notes

            Assignee:
            anna.henningsen@mongodb.com Anna Henningsen
            Reporter:
            dan@mongodb.com Daniel Pasette (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: