1

I'm having an issue with apache2 httpd. The apache is using mpm_prefork and the web application uses php.

I noticed that the machine where the apache runs suddenly drops to 0% cpu usage during the night. When I went to investigate the problem I saw 75 apache processes (75 is MaxClients) and they all did nothing.

When I straced the apache processes every one of them gave the following output

Process 18845 attached - interrupt to quit
restart_syscall(<... resuming interrupted call ...>) = 0
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 1000) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 1000) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 1000) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 1000) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 1000) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 1000) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 1000) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 1000) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 1000) = 0 (Timeout)
poll([{fd=22, events=POLLIN|POLLPRI|POLLRDNORM|POLLRDBAND}], 1, 0) = 0 (Timeout)

okay, what is fd22?

COMMAND     PID     USER   FD   TYPE    DEVICE SIZE/OFF   NODE NAME
/usr/sbin 18839 www-data   22u  IPv4 129846157      0t0    TCP myhost:44697 -> otherhost:http-alt (ESTABLISHED)
/usr/sbin 18844 www-data   22u  IPv4 129860789      0t0    TCP myhost:44906 -> otherhost:http-alt (ESTABLISHED)
/usr/sbin 18845 www-data   22u  IPv4 129846238      0t0    TCP myhost:44791 -> otherhost:http-alt (ESTABLISHED)
/usr/sbin 18848 www-data   22u  IPv4 129858987      0t0    TCP myhost:44967 -> otherhost:http-alt (ESTABLISHED)
/usr/sbin 18852 www-data   22u  IPv4 129861780      0t0    TCP myhost:44915 -> otherhost:http-alt (ESTABLISHED)
/usr/sbin 18864 www-data   22u  IPv4 129856031      0t0    TCP myhost:44795 -> otherhost:http-alt (ESTABLISHED)
/usr/sbin 18873 www-data   22u  IPv4 129856418      0t0    TCP myhost:44908 -> otherhost:http-alt (ESTABLISHED)
/usr/sbin 19225 www-data   22u  IPv4 129858977      0t0    TCP myhost:44936 -> otherhost:http-alt (ESTABLISHED)
/usr/sbin 19230 www-data   22u  IPv4 129857945      0t0    TCP myhost:44955 -> otherhost:http-alt (ESTABLISHED)

its a connection to another host. apparently this other machine (also in our network) is malfunctioning during a cronjob in the middle of the night and doesn't respond at all to requests for ~2hours. Okay, I currently can't fix the problem with the other machine and also I don't care about the wellbeeing of other machines.

All I wan't is for the processes to die if they can't finish in time. Apparently processes in the poll syscall don't count in terms of php max_execution_time.

Can I somehow tell apache to kill off these stale processes?

Debian GNU/Linux 7.8

apache2:
2.2.22-13+deb7u4

apache2-mpm-prefork:
2.2.22-13+deb7u4

apache2.2-bin:
2.2.22-13+deb7u4

apache2.2-common:
2.2.22-13+deb7u4

libapache2-mod-php5:
5.3.29-1~dotdeb.0
1
  • Check what are they doing. Maybe some mod_proxy thing?
    – peterh
    Apr 20, 2015 at 16:42

1 Answer 1

1

You could try if the TimeOut directive will do the trick http://httpd.apache.org/docs/2.2/mod/core.html#timeout

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .