Link to home
Start Free TrialLog in
Avatar of MaRiOsGR
MaRiOsGRFlag for Greece

asked on

host: isc_socket_create: not enough free resources

My apache hungs and in the log files I see hundreds of lines with this:

host: isc_socket_create: not enough free resources

any idea ?
Avatar of ravenpl
Flag of Poland image

Unix? increase open file limit for apache.
in startup script add following before apache startup
ulimit -n 10240
Avatar of MaRiOsGR


Ravenpl the solution was like that: (

RedHat RPMs packages are compiled by vendor with too small (1024) number of file descriptors and it might cause the following issues: in /var/log/httpd/error_log multiple strings could be seen with

Segmentation fault (11)
[warn] make_sock: problem listening on port 443, file descriptor (1068) larger than FD_SETSIZE (1024)
Unable to open logs
Too many open files

In this case you need to recompile OpenSSL, Apache, Imap and PHP from source RPM to increase FD_SETSIZE value. Please follow through the steps below.

Add the following lines to /etc/sysctl.conf:

fs.file-max = 131072

Run the following shell command:

# /sbin/sysctl -w fs.file-max=131072

Edit __FD_SETSIZE value in /usr/include/bits/types.h for RedHat 7.x or /usr/include/bits/typesizes.h and /usr/include/linux/posix_types.h for RedHat 9, Fedora Core, RHEL 2.1, 3, 4 (glibc-kernheaders and glibc-headers package has to have been installed before). If your system uses NPTL, you can find it with:

NPTL 2.3.4

then /usr/include/nptl/bits/typesizes.h header file also should be modified.

#define __FD_SETSIZE 131072

Download the following source RPM that could be found in other places such as or
libc-client-devel-*.src.rpm (if such RPM installed)

Recompile OpenSSL first. For example:

# /usr/bin/rpmbuild --rebuild openssl-0.9.7a-35.src.rpm

Install compiled OpenSSL RPM with the following command line:

# rpm -Uvh --force /usr/src/redhat/RPMS/i386/openssl-0.9.7a-35.i386.rpm

Repeat the same actions for CURL.

Recompile and install apache:

# rpmbuild --rebuild httpd-2.0.51-2.9.src.rpm
# rpm -Uvh --force /usr/src/redhat/RPMS/i386/httpd-2.0.51-2.9.i386.rpm
# rpm -Uvh --force /usr/src/redhat/RPMS/i386/httpd-devel-2.0.51-2.9.i386.rpm
# rpm -Uvh --force /usr/src/redhat/RPMS/i386/mod_ssl-2.0.51-2.9.i386.rpm

Recompile and install libc-client library which is provided by imap or libc-client-devel packages (it depends on OS) . You have to recompile one that is installed in the system:

# /usr/bin/rpmbuild --rebuild imap-2002d-3.src.rpm
# rpm -Uvh --force /usr/src/redhat/RPMS/i386/imap-devel-2002d-3.i386.rpm


# /usr/bin/rpmbuild --rebuild libc-client-devel.src.rpm
# rpm -Uvh --force /usr/src/redhat/RPMS/i386/libc-client-devel.rpm

Recompile and install PHP:

# rpmbuild --rebuild php-4.3.10-2.4.src.rpm
# rpm -Uvh --force /usr/src/redhat/RPMS/i386/php-*

Add 'ulimit -n 131072' command to /etc/rc.d/init.d/httpd and /usr/sbin/apachectl apache startup scripts before other commands.

also we had to recompile BIND
Avatar of Computer101
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In fact I work on RH machines, and I'm aware of select() problem with fd > 1024.
Hence You have not mentioned about that it's RH. Moreover You mentioned
> host: isc_socket_create: not enough free resources
which was caused by too low limit, then You provided the real(after You increased the limit) error, which is
> [warn] make_sock: problem listening on port 443, file descriptor (1068) larger than FD_SETSIZE (1024)