简体   繁体   中英

Total free allocated file descriptors always zero - Ubuntu 14.04 LTS

I have problem with free allocated file descriptors, it's always zero!

For example:

$ cat /proc/sys/fs/file-nr
  4448    0       1529806

AFAIK, that means following:

4448 is total alocated file descriptors
0 is total of free alocated file descriptors
1529806 is the total limit of the system

As well I set following ulimits:

$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 120242
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
**open files                      (-n) 500000**
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 120242
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

System file maximum:

$ cat /proc/sys/fs/file-max
 1529806

The most opened files are by Kannel daemons ( bearerbox and smppbox ). Once the amount of opened files hit the limit smppbox is being stuck and only restart of it can help which isn't a solution at all.

As per the articles I found on internet I understand that there is no free alocated file descriptors in the system.

Every solution I've tried didn't help.

What I'm doing wrong?

Need your help.

Thank you in advance.

As per the man page for proc : (emphasis mine)

/proc/sys/fs/file-nr
This (read-only) file contains three numbers: the number of allocated file handles (ie, the number of files presently opened); the number of free file handles; and the maximum number of file handles (ie, the same value as /proc/sys/fs/file-max). If the number of allocated file handles is close to the maximum, you should consider increasing the maximum. Before Linux 2.6, the kernel allocated file handles dynamically, but it didn't free them again. Instead the free file handles were kept in a list for reallocation; the "free file handles" value indicates the size of that list. A large number of free file handles indicates that there was a past peak in the usage of open file handles. Since Linux 2.6, the kernel does deallocate freed file handles, and the "free file handles" value is always zero.

So this will always be zero on kernel versions >= 2.6

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM