264 — TooManyFilesOpen

configurationperformanceconnectivity

The server has reached the maximum number of logical sessions

What is happening?

TooManyLogicalSessions is returned when the server cannot create a new logical session because the session cache has reached its configured limit. Every driver connection with implicit or explicit sessions consumes a session slot. Session leaks, high connection churn, or many short-lived application instances can exhaust this limit.

Common causes

  1. Application not ending sessions properly, causing accumulation
  2. High connection pool churn creating many short-lived sessions
  3. Many microservice instances each maintaining their own connection pools
  4. Session timeout (logicalSessionTimeoutMinutes) set too high

Source code references

ErrorCodes::TooManyFilesOpen found in 2 locations in the MongoDB server source.

Diagnostic Steps