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

Fail gracefully when virtual memory limit is exceeded

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.0
    • Component/s: MMAPv1, Storage
    • None
    • Storage Execution

      On SUSE11, there is a default virtual memory limit. For example,

      ip-10-184-155-113:~ # ulimit -a
      ....
      virtual memory          (kbytes, -v) 6314640
      ....
      

      When trying to create a capped collection that will push virtual memory over the limit, the mongod process crashes with the following:

      2014-04-24T18:53:14.934+0000 [initandlisten] connection accepted from 127.0.0.1:42041 #66 (28 connections now open)
      2014-04-24T18:53:14.934+0000 [FileAllocator] allocating new datafile /mnt/mydatabase.ns, filling with zeroes...
      2014-04-24T18:53:14.935+0000 [FileAllocator] done allocating datafile /mnt/mydatabase.ns, size: 16MB,  took 0 secs
      2014-04-24T18:53:14.937+0000 [FileAllocator] allocating new datafile /mnt/mydatabase.0, filling with zeroes...
      2014-04-24T18:53:14.938+0000 [FileAllocator] done allocating datafile /mnt/mydatabase.0, size: 64MB,  took 0 secs
      2014-04-24T18:53:14.938+0000 [conn66] ERROR:   mmap() failed for /mnt/mydatabase.0 len:67108864 errno:12 Cannot allocate memory
      2014-04-24T18:53:14.938+0000 [conn66] ERROR: mmap failed with out of memory. (64 bit build)
      2014-04-24T18:53:14.949+0000 [conn66] SEVERE: Invalid access at address: 0x68
      2014-04-24T18:53:14.957+0000 [conn66] SEVERE: Got signal: 11 (Segmentation fault).
      Backtrace:0x11bd301 0x11bc6de 0x11bc7cf 0x7f365770b7c0 0xee2e3d 0xee35ec 0xee5a5f 0xf1e259 0xf1d9c0 0x8afd8f 0x8b1c5a 0x8c14d0 0x8c0282 0xb9451e 0xb95122 0xb993d8 0x76b76f 0x117367b 0x7f36577037b6 0x7f3656ac0d6d
       ./mongod(_ZN5mongo15printStackTraceERSo+0x21) [0x11bd301]
       ./mongod() [0x11bc6de]
       ./mongod() [0x11bc7cf]
       /lib64/libpthread.so.0(+0xf7c0) [0x7f365770b7c0]
       ./mongod(_ZNK5mongo13ExtentManager17_getFreeListStartEv+0x2d) [0xee2e3d]
       ./mongod(_ZN5mongo13ExtentManager17allocFromFreeListEib+0x8c) [0xee35ec]
       ./mongod(_ZN5mongo13ExtentManager19increaseStorageSizeERKSsPNS_16NamespaceDetailsEii+0x4f) [0xee5a5f]
       ./mongod(_ZN5mongo19SimpleRecordStoreV111allocRecordEii+0x149) [0xf1e259]
       ./mongod(_ZN5mongo17RecordStoreV1Base12insertRecordEPKcii+0x60) [0xf1d9c0]
       ./mongod(_ZN5mongo10Collection15_insertDocumentERKNS_7BSONObjEbPKNS_16PregeneratedKeysE+0x7f) [0x8afd8f]
       ./mongod(_ZN5mongo10Collection14insertDocumentERKNS_7BSONObjEbPKNS_16PregeneratedKeysE+0x22a) [0x8b1c5a]
       ./mongod(_ZN5mongo8Database22_addNamespaceToCatalogERKNS_10StringDataEPKNS_7BSONObjE+0x5b0) [0x8c14d0]
       ./mongod(_ZN5mongo8Database16createCollectionERKNS_10StringDataERKNS_17CollectionOptionsEbb+0x252) [0x8c0282]
       ./mongod(_ZN5mongo14checkAndInsertERNS_6Client7ContextEPKcRNS_7BSONObjEPNS_16PregeneratedKeysE+0xbde) [0xb9451e]
       ./mongod(_ZN5mongo14receivedInsertERNS_7MessageERNS_5CurOpE+0x9f2) [0xb95122]
       ./mongod(_ZN5mongo16assembleResponseERNS_7MessageERNS_10DbResponseERKNS_11HostAndPortE+0xeb8) [0xb993d8]
       ./mongod(_ZN5mongo16MyMessageHandler7processERNS_7MessageEPNS_21AbstractMessagingPortEPNS_9LastErrorE+0x9f) [0x76b76f]
       ./mongod(_ZN5mongo17PortMessageServer17handleIncomingMsgEPv+0x4fb) [0x117367b]
       /lib64/libpthread.so.0(+0x77b6) [0x7f36577037b6]
       /lib64/libc.so.6(clone+0x6d) [0x7f3656ac0d6d]
      

            Assignee:
            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            Reporter:
            cory.mintz@mongodb.com Cory Mintz
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: