Skip to main content

CRE-2025-0113

MongoDB WiredTiger Cache OOM KillCritical
Impact: 10/10
Mitigation: 8/10

CRE-2025-0113View on GitHub

Description

Detects MongoDB Out-Of-Memory (OOM) kill caused by WiredTiger cache

pressure. This occurs when the cache fills with dirty pages faster

than they can be evicted, causing uncontrolled memory growth until

the OS kills the process.


Cause

  • WiredTiger cache size too small for workload
  • Write-heavy workload overwhelming eviction threads
  • Insufficient system memory for configured cache size
  • Eviction settings too conservative
  • Large documents or indexes consuming cache rapidly
  • Background operations (index builds, initial sync) adding pressure

Mitigation

IMMEDIATE ACTIONS:

  • Check if MongoDB restarted: `systemctl status mongod`
  • Verify data integrity: `db.runCommand({dbStats: 1})`
  • Check replica set status: `rs.status()`
  • Review memory configuration

CACHE CONFIGURATION:

  • Increase WiredTiger cache size (default: 50% of RAM - 1GB)
  • Set explicit cache size: `--wiredTigerCacheSizeGB`
  • Tune eviction targets:

* `wiredTigerEvictionTarget` (default: 80%)

* `wiredTigerEvictionTrigger` (default: 95%)

  • Lower dirty eviction targets:

* `wiredTigerEvictionDirtyTarget` (default: 5%)

* `wiredTigerEvictionDirtyTrigger` (default: 20%)


SYSTEM TUNING:

  • Add more system RAM
  • Set appropriate container memory limits
  • Configure swap space as safety net
  • Monitor memory usage continuously

WORKLOAD OPTIMIZATION:

  • Reduce document sizes
  • Batch writes to reduce pressure
  • Use write concern `{w:1, j:false}` for non-critical data
  • Schedule index builds during low traffic

References