Ошибка с количеством сокетов в ubuntu

Рейтинг: 2Ответов: 1Опубликовано: 08.12.2014

Starting Ncrack 0.4ALPHA ( http://ncrack.org ) at 2014-12-08 01:38 MSK nsock_core.c:186: Attempt to FD_SET fd 1024, which is not less than FD_SETSIZE (1024). Try using a lower parallelism. QUITTING!

Ошибка с количеством сокетов в ubuntu. Что это такое и как справиться?

Ответы

▲ 2

По умолчанию процессу доступно 1024 файловых дескрипторов (сокет это тоже файловый дескриптор).

Как посмотреть и настроить в конкретной системе можете посмотреть, например http://www.randombugs.com/linux/tuning-file-descriptors-limits-on-linux.html

Вообще же, посмотрите доку к Вашей программе. Скорее всего там есть ключик, задающий ограничение на их использование.

Update

Why we need to increase the number of file descriptors ?

Heavy loaded servers (but not only them) need that because they are opening a large number of files, sockets or other pseudo files. For each connection a server application will open a new socket and probably other files.

What is the limit of file descriptors per process ?

To see that just run the following command:

    ulimit -n

and you will get the number of file descriptors per your session (process).

How cand I modify the limit of file descriptors per session ?

Edit /etc/security/limits.conf and add:

    *                soft    nofile          65535
    *                hard    nofile          65535

This options will increase the number of file descriptors for all users. If you want just for a specific user replace * with the username. For example if you want to increase the limit for the apache file server just replace * with www-data (Debian specific) and after that just restart the apache (on Debian run: /etc/init.d/apache2 restart)