dataiotech Labs
dbaguidedbaguideDBAdataxtoolsdataopsphere
Home/Error Library/mongodb-too-many-open-files-wiredtiger-limit
MongoDB
MongoDB 6.0 - 8.0OS & Resources
10 min read
Too many open files / WiredTiger error: too many open files

MongoDB File Descriptor Exhaustion: ulimit -n Thresholds, Collection/Index Proliferation & systemd Hardening

Diagnosing OS file descriptor exhaustion under large collection counts and connection scaling; configuring systemd LimitNOFILE and limits.conf.

Reviewed by:Senior Database Architect & SRE (dataiotech Labs)
Tested Versions: MongoDB 6.0 / 7.0 / 8.0

Operational Verification & Reliability Metadata

Last Technical Review: 2 Kasım 2026
Tested VersionsMongoDB 7.0.8, 8.0.1 (Ubuntu 24.04 / RHEL 9)
Required PrivilegesOS root/sudo
Risk Assessment
CriticalFile descriptor starvation prevents WiredTiger write operations, forcing daemon termination
Expected OutputMax open files in /proc/$(pidof mongod)/limits verified at 64000
Rollback Procedure:Revert /etc/security/limits.conf and systemd unit
MongoDB Docs: UNIX ulimit Settings
First 60 Seconds Emergency Protocol:

The error string is a symptom, not the root cause. Do not restart the server blindly. Run the diagnostic queries below to pinpoint the actual failure mode.

▸Symptom

mongod drops inbound socket handshakes and logs:

plaintext
Failed to accept socket: Too many open files WiredTiger error (24): handle-open: open: Too many open files

▸What You See in Production

Database rejects incoming connections. File operations halt across collections and index files.


▸Root Cause Matrix

ProbabilityRoot CauseDescription
%60Default `ulimit -n 1024` ExhaustionWiredTiger maintains dedicated file descriptors per collection and index.
%30Socket File Descriptor StarvationSpikes in concurrent sockets consume available process descriptors.
%10Missing systemd LimitNOFILEsystemd limits override limits.conf without explicit overrides.

▸EMERGENCY RUNBOOK (0-5 min)

bash
# 1. Inspect live process limits cat /proc/$(pidof mongod)/limits | grep "Max open files" # 2. Elevate descriptors on running process via prlimit sudo prlimit --pid=$(pidof mongod) --nofile=64000:64000

▸PERMANENT BLUEPRINT

  1. 1systemd Hardening: Set LimitNOFILE=64000 in systemd unit overrides.
  2. 2limits.conf Tuning: Add mongod soft/hard nofile 64000.

▸Verification

bash
cat /proc/$(pidof mongod)/limits | grep "open files"

Other Database Error Triage Playbooks

Other battle-tested diagnostic guides for high-severity database errors.

All Errors (82)