Ultimamente, o Apache tem gerado trabalhadores, embora pareça não haver razão para isso. Após cerca de 10 minutos de reinicialização, ele continua gerando funcionários até atingir o número máximo e novas solicitações nunca são exibidas.
Após um reinício do serviço ( service apache2 restart
), comecei a monitorar o log de acesso. Houve apenas dois pedidos bastante simples antes de começar a gerar trabalhadores como um louco:
#/var/log/apache2/access.log
66.249.64.215 - - [17/Feb/2016:00:30:18 +0000] "GET /wp-content/uploads/2015/08/colarinho_3.png HTTP/1.1" 304 179 "-" "Googlebot-Image/1.0"
201.80.103.196 - - [17/Feb/2016:00:33:00 +0000] "GET /wp-content/uploads/2015/09/circulo_cromatico.png HTTP/1.1" 200 40642 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0"
E aqui está o fullstatus antes de parar completamente de atender novas solicitações.
$apache2ctl fullstatus
Apache Server Status for localhost (via ::1)
Server Version: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.12
Server MPM: prefork
Server Built: Jul 24 2015 17:25:11
__________________________________________________________________
Current Time: Wednesday, 17-Feb-2016 00:35:57 UTC
Restart Time: Wednesday, 17-Feb-2016 00:26:33 UTC
Parent Server Config. Generation: 1
Parent Server MPM Generation: 0
Server uptime: 9 minutes 24 seconds
Server load: 0.00 0.06 0.18
Total accesses: 3 - Total Traffic: 48 kB
CPU Usage: u0 s0 cu0 cs0
.00532 requests/sec - 87 B/second - 16.0 kB/request
22 requests currently being processed, 4 idle workers
WWWWWWWWWWWWWWWWWWWW_WW___........................
Scoreboard Key:
"_" Waiting for Connection, "S" Starting up, "R" Reading Request,
"W" Sending Reply, "K" Keepalive (read), "D" DNS Lookup,
"C" Closing connection, "L" Logging, "G" Gracefully finishing,
"I" Idle cleanup of worker, "." Open slot with no current process
Srv PID Acc M CPU SS Req Conn Child Slot Client VHost Request
0-0 6980 0/0/0 W 0.00 64 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/191.185.144.200 HTTP/1.0
1-0 6981 0/1/1 W 0.00 55 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
2-0 6982 0/1/1 W 0.00 52 0 0.0 0.04 0.04 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
3-0 6983 0/0/0 W 0.00 65 0 0.0 0.00 0.00 191.185.144.200
socialtailor.com.br:80 GET / HTTP/1.1
4-0 6984 0/0/0 W 0.00 64 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
5-0 6989 0/0/0 W 0.00 55 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
6-0 6990 0/0/0 W 0.00 50 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
7-0 6991 0/0/0 W 0.00 41 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
8-0 6992 0/0/0 W 0.00 50 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
9-0 6993 0/0/0 W 0.00 40 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
10-0 6994 0/0/0 W 0.00 38 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
11-0 6995 0/0/0 W 0.00 35 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
12-0 6996 0/0/0 W 0.00 24 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
13-0 6997 0/0/0 W 0.00 32 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
14-0 6998 0/0/0 W 0.00 24 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
15-0 6999 0/0/0 W 0.00 24 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
16-0 7000 0/0/0 W 0.00 11 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
17-0 7001 0/0/0 W 0.00 7 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
18-0 7002 0/0/0 W 0.00 7 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
19-0 7003 0/0/0 W 0.00 4 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
20-0 7004 0/1/1 _ 0.00 7 0 0.0 0.01 0.01 ::1 socialtailor.com.br:80 GET
/server-status HTTP/1.0
21-0 7005 0/0/0 W 0.00 2 0 0.0 0.00 0.00 127.0.0.1
socialtailor.com.br:80 GET /lookup/127.0.0.1 HTTP/1.0
22-0 7006 0/0/0 W 0.00 0 0 0.0 0.00 0.00 ::1 socialtailor.com.br:80 GET
/server-status HTTP/1.0
__________________________________________________________________
Srv Child Server number - generation
PID OS process ID
Acc Number of accesses this connection / this child / this slot
M Mode of operation
CPU CPU usage, number of seconds
SS Seconds since beginning of most recent request
Req Milliseconds required to process most recent request
Conn Kilobytes transferred this connection
Child Megabytes transferred this child
Slot Total megabytes transferred this slot
__________________________________________________________________
Apache/2.4.7 (Ubuntu) Server at localhost Port 80
O site que está sendo veiculado tem uma instalação do Wordpress. Atualizei-o para a versão mais recente e desabilitei as tarefas do cron. Alguma idéia do porquê isso está acontecendo ou como depurar isso ainda mais?
Outra coisa estranha: se eu fizer um lynx http://localhost/
, ele fica esperando uma resposta para sempre (mesmo se o Apache não estiver sobrecarregado de trabalhadores) e imediatamente o Apache começa a gerar muitos trabalhadores, como antes.
Estou usando o mpm_prefork com o seguinte conf:
#/etc/apache2/mods-enabled/mpm_prefork.conf
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 50
MaxConnectionsPerChild 1000
</IfModule>