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

Passing impossible value to skip on aggregation framework causes mongo to exit with out of memory

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 2.5.2
    • Affects Version/s: 2.4.3
    • Labels:
      None
    • Environment:
      Ubuntu 12.04 LTS, MongoDB 2.4.3
    • Fully Compatible
    • ALL
    • Hide

      send "aggregate" command with some $match and pass 4294967294 to $skip operator. mongo should immediately exit.

      1. Did not try this with different number but I suspect big enough number would cause mongo to exit as well

      2. Did not try this with "normal" query (non aggregation framework)

      Show
      send "aggregate" command with some $match and pass 4294967294 to $skip operator. mongo should immediately exit. 1. Did not try this with different number but I suspect big enough number would cause mongo to exit as well 2. Did not try this with "normal" query (non aggregation framework)

      When passing the following value to $skip on aggregation framework, mongo immediately exists with log message "out of memory"
      The value passed to skip was: 4294967294

      It appears mongo tries to allocate memory according to this number and fails with out of memory.

      In the log file:
      tcmalloc: large alloc 103079223296 bytes == (nil) @
      Mon Jul 8 19:41:46.915 out of memory, printing stack and exiting:

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            chenfisher Chen Fisher
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: