# WiredTiger error (0) - cache stuck: eviction worker thread stalled for 120 seconds

- **ID:** `mongodb/wiredtiger-cache-eviction-stall`
- **Domain:** mongodb
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

WiredTiger cache is full and eviction cannot keep up, often due to high write load or insufficient cache size.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| mongodb-4.2 | active | — | — |
| mongodb-4.4 | active | — | — |
| mongodb-5.0 | active | — | — |
| mongodb-6.0 | active | — | — |
| mongodb-7.0 | active | — | — |

## Workarounds

1. **Increase WiredTiger cache size in mongod.conf: storage.wiredTiger.engineConfig.cacheSizeGB: 4 (adjust based on available RAM). Restart mongod.** (70% success)
   ```
   Increase WiredTiger cache size in mongod.conf: storage.wiredTiger.engineConfig.cacheSizeGB: 4 (adjust based on available RAM). Restart mongod.
   ```
2. **Reduce write load by batching writes or using a write queue. Monitor with db.serverStatus().wiredTiger.cache.** (80% success)
   ```
   Reduce write load by batching writes or using a write queue. Monitor with db.serverStatus().wiredTiger.cache.
   ```
3. **Add more secondary nodes to distribute read load, reducing cache pressure on primary. Example: rs.add('newSecondary:27017')** (75% success)
   ```
   Add more secondary nodes to distribute read load, reducing cache pressure on primary. Example: rs.add('newSecondary:27017')
   ```

## Dead Ends

- **** — Smaller cache makes eviction pressure worse; the error is caused by insufficient cache, not excess. (80% fail)
- **** — This increases risk of data loss and does not address the eviction bottleneck. (90% fail)
- **** — If memory is constrained, this can cause OOM kills; the root cause is often eviction efficiency, not cache size. (50% fail)
