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

Discussion in 'Proxmox VE: Installation and configuration' started by natten, Aug 10, 2016.

  1. natten

    natten New Member

    Joined:
    Jul 21, 2016
    Messages:
    3
    Likes Received:
    1
    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?
     
    naisanza likes this.
  2. wbumiller

    wbumiller Proxmox Staff Member
    Staff Member

    Joined:
    Jun 23, 2015
    Messages:
    642
    Likes Received:
    80
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. natten

    natten New Member

    Joined:
    Jul 21, 2016
    Messages:
    3
    Likes Received:
    1
    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?
     
  4. fabian

    fabian Proxmox Staff Member
    Staff Member

    Joined:
    Jan 7, 2016
    Messages:
    3,194
    Likes Received:
    494
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. naisanza

    naisanza Member

    Joined:
    Aug 11, 2016
    Messages:
    31
    Likes Received:
    1
  6. Kephin

    Kephin New Member

    Joined:
    Apr 21, 2015
    Messages:
    8
    Likes Received:
    0
    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...
     
  7. smacz

    smacz New Member

    Joined:
    May 19, 2018
    Messages:
    1
    Likes Received:
    0
    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.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice