Avatar of MaRiOsGR
MaRiOsGR
Flag 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 ?
Apache Web Server

Avatar of undefined
Last Comment
ravenpl

8/22/2022 - Mon
ravenpl

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

ASKER
Ravenpl the solution was like that: (http://kb.swsoft.com/article_41_260_en.html)

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)
or
Unable to open logs
or
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:

$ getconf GNU_LIBPTHREAD_VERSION
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 http://rpm.pbone.net or http://rpmfind.net:
openssl-*.src.rpm
httpd-*.src.rpm
imap-*.src.rpm
php-*.src.rpm
libc-client-devel-*.src.rpm (if such RPM installed)
curl-*.src.rpm

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

or

# /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
ASKER CERTIFIED SOLUTION
Computer101

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ravenpl

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)
Your help has saved me hundreds of hours of internet surfing.
fblack61