分配的空闲文件描述符总数始终为零 - Ubuntu 14.04 LTS

Total free allocated file descriptors always zero - Ubuntu 14.04 LTS

我对自由分配的文件描述符有疑问,它始终为零!

例如:

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

据我所知,这意味着以下内容:

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

我还设置了以下 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

系统文件最大值:

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

打开次数最多的文件由 Kannel 个守护进程(bearerboxsmppbox)打开。一旦打开的文件数量达到限制 smppbox 就会卡住,只有重新启动它才能有所帮助,这根本不是解决方案。

根据我在互联网上找到的文章,我了解到系统中没有空闲的分配文件描述符。

我尝试过的所有解决方案都没有帮助。

我做错了什么?

需要你的帮助。

提前致谢。

根据 man page for proc:(强调我的)

/proc/sys/fs/file-nr
This (read-only) file contains three numbers: the number of allocated file handles (i.e., the number of files presently opened); the number of free file handles; and the maximum number of file handles (i.e., 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.

因此在内核版本 >= 2.6

上这将始终为零