linux - 免费分配的文件描述符总数始终为零 - Ubuntu 14.04 LTS

标签 linux ubuntu-14.04 kannel

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

例如:

$ 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 上这将始终为零

关于linux - 免费分配的文件描述符总数始终为零 - Ubuntu 14.04 LTS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43870640/

相关文章:

linux - iMacros + FF : Linux, 命令行

c - 意外标记附近的语法错误

cuda - 在 Ubuntu 中验证支持 CUDA 的 GPU

java - 根据servlet中的输入参数更改编码

linux - 使用 Bash 自动将最后一个命令的输出捕获到变量中?

c++ - basic_string.tcc 中的核心转储 - 优化了

linux - 遍历用户输入

python-2.7 - 属性错误 : 'module' object has no attribute 'merge_all_summaries'

php - 发送短信以从数据库 Kannel 中删除用户

php - 在 Kannel 中实现优先级队列