Too many open files¶
If you need expert help with this or any other issue, please see our terms and conditions at tech support.
Description¶
With a large number of cameras (>70), you may encounter Inotify limitations, then when adding a camera in the Docker container log (in the case of executor=docker
) or the server itself (in the case of executor=exec
) you can see the message:
Error: too many open files
By default, Ubuntu has the following options:
sysctl fs.inotify
fs.inotify.max_queued_events = 16384
fs.inotify.max_user_instances = 128
fs.inotify.max_user_watches = 524288
ulimit -n
10240
grep NOFILE /etc/systemd/system.conf
#DefaultLimitNOFILE=1024:524288
Solution¶
To increase the limits, add the following options to the /etc/sysctl.conf
file:
sudo su
cat << EOF >> /etc/sysctl.conf
fs.inotify.max_queued_events = 16384
fs.inotify.max_user_instances = 10240
fs.inotify.max_user_watches = 524288
EOF
in the file /etc/systemd/system.conf
:
DefaultLimitNOFILE=10240:524288
and reboot the system.
Make sure the settings are applied:
ulimit -n
10240
sysctl fs.inotify
fs.inotify.max_queued_events = 16384
fs.inotify.max_user_instances = 10240
fs.inotify.max_user_watches = 524288