inotify 的 sysctl setting

最後更新: 2020-04-06

 

 


max_user_watches

 

# Defaut: 8192

/proc/sys/fs/inotify/max_user_watches

Modify

/etc/sysctl.conf

fs.inotify.max_user_watches=81920

sysctl -p

Checking

cat /proc/sys/fs/inotify/max_user_watches

Remark

Open file descriptors can by listed via procfs:

ls -al /proc/<application process number>/fd/

 


max_user_instances

 

# Defaut: 128

/proc/sys/fs/inotify/max_user_instances

An "instance" is single file descriptor, returned by inotify_init().

A single inotify file descriptor can be used by one process or shared by multiple processes,

so they are rationed per-user instead of per-process.

If an application creates too many instances,

it either starts too many processes (and does not share inotify file descriptors between processes),

or it is just plain buggy — for example, it may leak open inotify descriptors (open and then forget about them without closing).