Read more

Uncaught exception in PassengerServer client thread exception: Cannot accept new connection: Too many open files

Thomas Eisenbarth
April 27, 2012Software engineer at makandra GmbH

So you probably see the following error trace within your Passenger log file if you got here:

[ pid=123 thr=1401414 file=ext/nginx/HelperAgent.cpp:964 time=2012-04-27 10:01:49.273 ]: Uncaught exception in PassengerServer client thread:
   exception: Cannot accept new connection: Too many open files (24)
   backtrace:
     in 'Passenger::FileDescriptor Client::acceptConnection()' (HelperAgent.cpp:429)
     in 'void Client::threadMain()' (HelperAgent.cpp:953)
Illustration money motivation

Opscomplete powered by makandra brand

Save money by migrating from AWS to our fully managed hosting in Germany.

  • Trusted by over 100 customers
  • Ready to use with Ruby, Node.js, PHP
  • Proactive management by operations experts
Read more Show archive.org snapshot

You can either

  1. Lower the maximum number of running Passenger instances. Use passenger_max_pool_size within nginx configuration and the PassengerMaxPoolSize directive in Apache. See [http://www.modrails.com/documentation.html] Passenger documentation for details.
  2. Increase the maximum number of open files per process. If you google around, don't get confused by the forum guys suggesting to look at cat /proc/sys/fs/file-max - this is the global maximum, an arbitrary won't be allowed to open that number of FDs. You will have to set limits within /etc/security/limits.conf in case you need that.
Posted by Thomas Eisenbarth to makandra dev (2012-04-27 10:11)