gpt4 book ai didi

linux - linux 文件描述符限制如何工作?

转载 作者:IT王子 更新时间:2023-10-29 00:27:24 29 4
gpt4 key购买 nike

有人告诉我,我的服务器拒绝在特定端口接受客户端网络连接,这可能是由于缺少文件描述符。我查了一下这是怎么回事,并在这里阅读:http://www.netadmintools.com/art295.html

所以我测试了我的系统,我得到了这个:

cat /proc/sys/fs/file-nr
1088 0 331287

这是什么意思?

即使在我关闭服务器后,第二列实际上仍保持为 0,甚至在启动后它甚至仍保持在 0!

最佳答案

你想看看/proc/sys/fs/file-max

来自最近的 linux/Documentation/sysctl/fs.txt:

file-max & file-nr:

The kernel allocates file handles dynamically, but as yet itdoesn't free them again.

The value in file-max denotes the maximum number of file-handles that the Linux kernel will allocate. When you get lotsof error messages about running out of file handles, you mightwant to increase this limit.

Historically, the three values in file-nr denoted the number ofallocated file handles, the number of allocated but unused filehandles, and the maximum number of file handles. Linux 2.6 alwaysreports 0 as the number of free file handles -- this is not anerror, it just means that the number of allocated file handlesexactly matches the number of used file handles.

Attempts to allocate more file descriptors than file-max arereported with printk, look for "VFS: file-max limit reached".

编辑:根本错误可能不是系统用完了全局文件描述符,而是您的进程。问题似乎是 maximum size limit of select .

关于linux - linux 文件描述符限制如何工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3991223/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com