Page 1 of 1

Too many open files in system

Posted: Sat Nov 20, 2010 10:55 am
by help40
I am getting this error message in apache logs

"Too many open files in system"

is it related to zoneminder ? or not ?

any resolution?

Posted: Sat Nov 20, 2010 6:20 pm
by jdhar
I think it's related, but I don't know the answer... reason being that I started getting this after in stalling ZM too, and haven't figured out. I just have to reboot every few days :(

Posted: Sun Nov 21, 2010 12:03 am
by help40
I definatelly do not like to be babysitter of my Zoneminder ...
The problem is when someone watch monitor for too long ...

the file descriptor of the system by default is 1024
you can see it with

# ulimit -a

I hope I found the answer , I am testing it now ....
editing

apachectl (mine is here - /usr/sbin/apachectl )

and adding

ULIMIT_MAX_FILES="ulimit -n 16384"

you can also take a look here, where I found this answer :

http://serverfault.com/questions/20183/ ... -in-system

Posted: Sun Nov 21, 2010 4:05 am
by timcraig
Zoneminder uses alot of open files when it's using mapped memory.

Linux has a set limit of how many files that can be opened at the same time. You can see the current limit:

Code: Select all

cat /proc/sys/fs/file-max


To change the max, you can edit the /etc/sysctl.conf. So for example, your current max is at 5000 and you want to change it to 10000. You add the line to your /etc/sysctl.conf file:

Code: Select all

fs.file-max = 100000

To make the change go into effect, you then run

Code: Select all

sysctl -p

Posted: Mon Nov 22, 2010 12:24 pm
by help40
so You suggest increasing to 100 000?

by the way this file is not present by default in Slackware , but I read that
"if you create that file /etc/sysctl.conf yourself, then slackware will automatically run "/sbin/sysctl -e -p /etc/sysctl.conf" everytime you boot."

Posted: Mon Nov 22, 2010 10:06 pm
by timcraig
I increasing the file max to double the size of your current amount.

So if "cat /proc/sys/fs/file-max" returns n

Set the max to 2n



If the /etc/sysctl.conf file doesn't exist go ahead and create one.

I should have mentioned that you'll only need to run sysctl -p just to make the new settings in sysctl.conf go into effect without needing to reboot the computer. You won't have do call that program everytime you computer starts up.

Posted: Tue Nov 23, 2010 12:00 pm
by help40
I will test it , I am not sure this one will help

ulimit -n still show 1024 after that