Socket accept - “Too many open files”

后端 未结 13 1930
情歌与酒
情歌与酒 2020-11-28 02:48

I am working on a school project where I had to write a multi-threaded server, and now I am comparing it to apache by running some tests against it. I am using autobench to

13条回答
  •  没有蜡笔的小新
    2020-11-28 03:10

    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.

提交回复
热议问题