Server freeze caused by Apache

Petertjuh360

Verified User
Joined
Nov 7, 2010
Messages
340
Hello,

At random times my server crashes (every 2/3 weeks).
When i look at the automatic message generated by DirectAdmin, I see alot of httpd processes:
This is an automated message notifying you that the 5 minute load average on your system is 240.58.
This has exceeded the 10 threshold.

One Minute - 247.5
Five Minutes - 240.58
Fifteen Minutes - 198.24

top - 18:56:03 up 13 days, 4:09, 1 user, load average: 268.72, 256.06, 227.83
Tasks: 402 total, 1 running, 398 sleeping, 0 stopped, 3 zombie
Cpu(s): 2.0%us, 1.0%sy, 0.2%ni, 88.3%id, 6.7%wa, 0.0%hi, 0.0%si, 1.9%st
Mem: 1014552k total, 1006156k used, 8396k free, 148k buffers
Swap: 1048572k total, 1048572k used, 0k free, 5936k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
427 root 20 0 0 0 0 D 0.6 0.0 5:45.12 [kswapd0]
12534 r46w1 20 0 109m 6144 640 D 0.5 0.6 0:01.77 /usr/sbin/httpd -k start -DSSL
12332 r46w1 20 0 116m 12m 536 D 0.5 1.3 0:03.05 /usr/sbin/httpd -k start -DSSL
12551 r46w1 20 0 109m 6276 720 D 0.4 0.6 0:01.46 /usr/sbin/httpd -k start -DSSL
12361 r46w1 20 0 116m 14m 1360 D 0.4 1.4 0:01.87 /usr/sbin/httpd -k start -DSSL
1669 root 10 -10 5128 2968 1872 S 0.3 0.3 4:52.09 iscsid
12542 r46w1 20 0 106m 2720 648 D 0.3 0.3 0:01.07 /usr/sbin/httpd -k start -DSSL
7751 root 20 0 106m 2984 1180 S 0.3 0.3 0:14.16 /usr/sbin/httpd -k start -DSSL
3935 named 20 0 153m 1052 276 S 0.3 0.1 2:21.96 /usr/sbin/named -u named
12560 root 20 0 41812 1084 44 D 0.3 0.1 0:00.93 /usr/sbin/munin-node
12564 r46w1 20 0 106m 2304 344 D 0.3 0.2 0:00.93 /usr/sbin/httpd -k start -DSSL
12351 root 20 0 49320 1344 980 D 0.3 0.1 0:01.70 /usr/local/directadmin/dataskq
11984 r46w1 20 0 116m 5016 592 D 0.3 0.5 0:03.76 /usr/sbin/httpd -k start -DSSL
11931 r46w1 20 0 110m 4552 604 D 0.2 0.4 0:03.84 /usr/sbin/httpd -k start -DSSL
12530 root 20 0 46888 780 504 S 0.2 0.1 0:00.84 crond
12157 r46w1 20 0 109m 4824 560 D 0.2 0.5 0:02.68 /usr/sbin/httpd -k start -DSSL
15034 dovecot 20 0 45860 1388 1240 D 0.2 0.1 0:00.79 dovecot/pop3-login
12189 mysql 20 0 60028 8516 572 D 0.2 0.8 0:04.03 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --log-error=/var/lib/mysql/xxxxxxx.err --pid-file=/var/lib/mysql/xxxxx.pid --socket=/var/lib/mysql/mysql.sock --port=3306
12532 r46w1 20 0 106m 2652 464 D 0.2 0.3 0:00.76 /usr/sbin/httpd -k start -DSSL
12164 r46w1 20 0 116m 6196 508 D 0.2 0.6 0:02.56 /usr/sbin/httpd -k start -DSSL
11962 r46w1 20 0 116m 4836 596 D 0.2 0.5 0:01.97 /usr/sbin/httpd -k start -DSSL
12352 r46w1 20 0 107m 4740 1500 D 0.2 0.5 0:01.89 /usr/sbin/httpd -k start -DSSL
4155 ftp 20 0 46336 436 280 S 0.2 0.0 0:02.53 proftpd: (accepting connections)

How can I prevent my server from freezing/crashing?
A forced reboot is needed to solve the freeze/crash.
 
1gb of ram is not that much. Try increasing your hardware. What kind of site is that r46 user running. It might be too busy for your hardware.
 
1gb of ram is not that much. Try increasing your hardware. What kind of site is that r46 user running. It might be too busy for your hardware.

Just normal HTML sites.

I tuned my Apache and we will see how it's going.
 
Found the problem.
I have a lot of this in my error log:
[Thu Jul 19 13:14:03.926964 2012] [core:error] [pid 26992] AH00047: could not make child process 23815 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927003 2012] [core:error] [pid 26992] AH00047: could not make child process 24675 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927013 2012] [core:error] [pid 26992] AH00047: could not make child process 25562 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927021 2012] [core:error] [pid 26992] AH00047: could not make child process 23788 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927057 2012] [core:error] [pid 26992] AH00047: could not make child process 25616 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927103 2012] [core:error] [pid 26992] AH00047: could not make child process 22680 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927130 2012] [core:error] [pid 26992] AH00047: could not make child process 25129 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927139 2012] [core:error] [pid 26992] AH00047: could not make child process 22553 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927147 2012] [core:error] [pid 26992] AH00047: could not make child process 23830 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927194 2012] [core:error] [pid 26992] AH00047: could not make child process 23834 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927203 2012] [core:error] [pid 26992] AH00047: could not make child process 23835 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927249 2012] [core:error] [pid 26992] AH00047: could not make child process 25147 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927291 2012] [core:error] [pid 26992] AH00047: could not make child process 25058 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927302 2012] [core:error] [pid 26992] AH00047: could not make child process 22564 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927310 2012] [core:error] [pid 26992] AH00047: could not make child process 25386 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927344 2012] [core:error] [pid 26992] AH00047: could not make child process 23849 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927366 2012] [core:error] [pid 26992] AH00047: could not make child process 24959 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927375 2012] [core:error] [pid 26992] AH00047: could not make child process 23856 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927383 2012] [core:error] [pid 26992] AH00047: could not make child process 23857 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927391 2012] [core:error] [pid 26992] AH00047: could not make child process 23858 exit, attempting to continue anyway
[Thu Jul 19 13:14:03.927399 2012] [core:error] [pid 26992] AH00047: could not make child process 23864 exit, attempting to continue anyway

I can simple crash Apache by holding my F5 button.
Im now installing mod_evasive.
-edit-
mod_evasive isn't compatible with Apache 2.4
 
Last edited:
Something is miss configured then. You shouldnt be able to do that.
 
Found this out: If I hold my F5 button on static pages (html) the server doesn't crash, but when I do this on websites with Wordpress, the server freezes totally.

I still don't know how to fix this.
 
You might need to do all of these or partly:

1. Limit connections to 80 port within one second (firewall)
2. Limit connections to a virtual host or your Virtual Host IP from any single IP (firewall or other software)
3. Limit connections to a virtual host or your Virtual Host IP from any /24 subnet (firewall or other software)
4. Limit connections for every user to MySQL server (edit php.ini)
5. Limit max allowed number of total connections to MySQL (edit /etc/my.cnf)
6. Install APC/eAccelerator/etc
7. Enable PAM limits
8. Install frontend to Apache
9. Use an effective caching plugin for WP
10. Google for more https://www.google.com/search?q=wordpress speedup

The most of these steps have been discussed here. So before asking how to do any these step, please search the forums.
 
I'm not actually having a problem, this is a question.

Most Google results just have a DROP line
eg
-A INPUT -p tcp –dport 80 -m state –state NEW -m recent –update –seconds 60 –hitcount 5 -j DROP
Silly question, but I assume I keep my
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
afterwards? Otherwise port 80 will be closed obviously.
 
I have all my drops before the accepts (I use Webmin to admin iptables, so it saves to a file).

I found the rule order is important i.e. if you have a drop after an accept, nothing will be dropped.
 
Back
Top