Linux: socket accept - "Too many open files"

来源:互联网 发布:太阳照常升起知乎 编辑:程序博客网 时间:2024/05/17 05:59

一个老问题了,经常忘记如何去fixed,所以在这里mark一下!

There are multiple places where Linux can have limits on the number of file descriptors you are allowed to open.

You can check the following:

cat /proc/sys/fs/file-max

That will give you the system wide limits of file descriptors.

On the shell level, this will tell you your personal limit:

ulimit -n

This can be changed in /etc/security/limits.conf - it's the nofile param.

However, if you're closing your sockets correctly, you shouldn't receive this unless you're opening a lot of simulataneous connections. It sounds like something is preventing your sockets from being closed appropriately. I would verify that they are being handled properly.

文章来源:http://stackoverflow.com/questions/880557/linux-socket-accept-too-many-open-files

原创粉丝点击