[SOLVED] Failed to allocate directory watch: Too many open files

natten

Active Member
Jul 21, 2016
3
1
43
31
Anyone knows what to do with "Failed to allocate directory watch: Too many open files" in containers?

It happens in every container so i suppose its an issue with the host.
I've tried to add the following to the /etc/security/limits.conf on the host but with no luck
Code:
root             -       nofile          unlimited
*                -       nofile          unlimited

Anyone got a clue how i should proceed?
 
  • Like
Reactions: naisanza
Do you have lots of containers running? Then you probably ran into the inotify limits:
These are the defaults:
Code:
# sysctl fs.inotify
fs.inotify.max_queued_events = 16384
fs.inotify.max_user_instances = 128
fs.inotify.max_user_watches = 65536

Try increasing the instance limit, eg. # sysctl fs.inotify.max_user_instances=512
 
  • Like
Reactions: flotho
Do you have lots of containers running? Then you probably ran into the inotify limits:
These are the defaults:
Code:
# sysctl fs.inotify
fs.inotify.max_queued_events = 16384
fs.inotify.max_user_instances = 128
fs.inotify.max_user_watches = 65536

Try increasing the instance limit, eg. # sysctl fs.inotify.max_user_instances=512

Thanks seems like it worked!
I have 12 containers running with different services.
What are the consequences of increasing this limit, and what is the maximum i should set it to?
 
Also ran into this issue at about the fifteenth container I was trying to deploy/restore. (during migration from PX3) which is not a lot in our use case. (fairly simple single purpose webserver contianers)
I would definitely say this limit needs increasing OOTB...
 
I just ran into this with 8 LXC containers! Granted, they all were running various daemons...Increasing the `inotify` settings in the `/etc/sysctl.conf` worked like a charm though.
 
Hello,

I got an 4 x CPU total 80 Cores with 512GB Ram i have around 55 lxc on it, the cpu is 0 chill, ram usage 20gb,

sysctl fs.inotify.max_user_instances=512

Fixed my issue.

I think this should be considering increasead from the instalation of on server because i`m not the only one with powerfull servers

proxmox 5.4