Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-1258

eheap_alloc OOM errors when attempting to build selected views

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.2, 1.2.1
    • Component/s: None
    • Labels:
      None
    • Environment:
    • Skill Level:
      Committers Level (Medium to Hard)

      Description

      We spotted OOM errors crashing our CouchDb instance when attempting to rebuild selected views. CouchDb was dying with the following messages (worth noting that the type reported varies between heap/old_heap

      eheap_alloc: Cannot allocate 478288480 bytes of memory (of type "heap").
      eheap_alloc: Cannot allocate 597860600 bytes of memory (of type "heap").
      eheap_alloc: Cannot allocate 747325720 bytes of memory (of type "old_heap").
      eheap_alloc: Cannot allocate 597860600 bytes of memory (of type "old_heap").

      By modifying the view I was able to find a view that could consistently crash the server and another that ran fine. They are as follows:

      Runs out of memory v.quickly
      {
      "_id": "_design/cleanup",
      "_rev": "5-e004fbab278355e9d08763877e5a8295",
      "views": {
      "byDate": {
      "map": "function(doc)

      { if (! doc.action) emit([doc.date], doc); }

      "
      }
      }
      }

      Runs fine with minimal memory usage (returns 88128 docs in the view)
      {
      "_id": "_design/cleanup",
      "_rev": "6-3823be6b72ca2441e235addfece6900c",
      "views": {
      "byDate": {
      "map": "function(doc)

      { if (doc.action) emit([doc.date], doc); }

      "
      }
      }
      }

      The only difference between the two is the negation of the if conditional.

      memory usage was monitored with top on the machine while the view was being built. Under correct behaviour I could see beam.smp using just 3 or 4% of the server's memory. With the view that causes problems that memory usage increased until the RAM/swap on the server was exhausted (as you can see from the error messages around 500/700MB)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                james.cohen James Cohen
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: