domenica 18 marzo 2012

Too many open files - Linux

When an application (server) opens many files (or network connections) on your system sometimes application log shows some file system failure with a message like 'Too Many Open Files'.
That means that user runnig your application open much more files/ connection than admitted.
To solve the problem (assure first that program also closes files correctly) follow this steps:

Count opened files and modify permission


  1. lsof –u <your_user>   | wc -l
  2. lsof +p <your application process>  | wc -l
Default permittet size for opened file is usually about 1000. 
Find your system settings in cat /etc/security/limits.conf
You can modify these settings editing that file at your convenience. For example:

<your_user>       soft    nofile          2048
<your_user>      hard    nofile          8192

NOTE: modify /etc/security/limits.conf doesn't require system reboot. You probably have only to restart application which can't open more files . 

Nessun commento:

Posta un commento