MongoDB: Out of memory: Killed process (mongod) — WiredTiger cache + queries exhausted RAM
The Linux OOM killer terminated mongod because the host ran out of memory.
Out of memory: Killed process mongodmongod.service: A process of this unit has been killed by the OOM killerKilled process 1234 (mongod) total-vmmongod OOM killed container exit code 137WiredTiger cache memory exceeded OOM Meaning
Check dmesg | grep -i "killed process". Limit the WiredTiger cache (storage.wiredTiger.engineConfig.cacheSizeGB), especially in containers where MongoDB reads host RAM instead of the cgroup limit (older versions). Avoid huge in-memory sorts/aggregations, add indexes, and size the host properly with swap off for DBs but enough RAM.
Common causes
- Container memory limit smaller than WiredTiger default cache
- Large aggregations without indexes (allowDiskUse needed)
- Other processes sharing the host
- Too many connections (each uses memory)
- Undersized instance
⚡ Quick fix
- Set
cacheSizeGBto ~50% of available RAM (or lower in containers) - Add indexes; use
allowDiskUse: true - Move to a larger instance or isolate mongod
Detailed fix by platform
Linux
dmesg -T | grep -i -E "killed process|out of memory"; free -h
How to diagnose
- dmesg — OOM entry?
- Cache — Configured?
- Queries — Heavy aggregations?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Atlas: bad auth: Authentication failed MongoServerError: bad auth : Authentication failed. (Atlas user / special characters in password)
- BSONObj size is invalid / exceeds maximum document size (16MB) MongoServerError: BSONObj size: 17825792 (0x1100000) is invalid. Size must be between 0 and 16793600(16MB)
- Can't connect from another host (bindIp 127.0.0.1) MongoDB: connection refused / timed out from a remote host — mongod bindIp defaults to 127.0.0.1
Most viewed in MongoDB
- Document failed validation MongoDB: MongoServerError: Document failed validation (code 121)
- MongoParseError MongoDB: MongoParseError: Invalid scheme, expected connection string to start with "mongodb://" or "mongodb+srv://"
- bad auth : Authentication failed MongoDB: MongoServerError: bad auth : Authentication failed (code 8000 / 18)
Other ways to find it
Where this error sits
Origin: Data. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026