Subject Re: [firebird-support] Database Errors: "Too many files open"
Author Helen Borrie
At 11:46 PM 14/01/2008, you wrote:
>I keep getting this error:
>
>I/O error for file "<DB_FILENAME>"

The first part is error 335544344, the high-level, generic I/O exception...

>Error while trying to open file

..error 335544734, because Firebird can't open the database file...

>Too many open files

..while this one is delivered from the operating system, which is the best Firebird can do to help. It's not a Firebird error and Fb has no knowledge of or control over files opened by other applications.


>I run Apache 1.3.39;

Pretty old - and Apache 1 was pretty famous for causing this error, esp. if the keepalive was configured on.

>Linux 2.6.9; with PHP 5.2.4 and firebird 1.5.4
>
>The error started appearing a week ago out of the blues
>
>What causes this error and how do i fix this

Fix - not knowing the cause, I don't know; but you could do some monitoring with lsof to find out which application(s) are eating up your file handles.

You could consider raising the file-max and inode-max settings (inode-max has to be 4 * file-max). see whether you can cat /proc/sys/fs/file-nr and /proc/sys/fs/inode-nr on your linux - these give you the respective current count and max for files and inodes.

Supposing your OS has quite a low default setting (e.g. 4096 and 16384 resp.) you should be able to increase file-max and inode-max at runtime without having to restart the system, just by echoing some new values to the respective config files, e.g.

echo 8192 > /proc/sys/fs/file-max
echo 32768 > /proc/sys/fs/inode-max

If that removes the problem, you can add these lines to
/etc/sysctl.conf to have it automatically configured at boot-time:

# Set maximum files and inodes
fs.file-max = 8192
fs.inode-max = 32768

./heLen