Subject: | PreFork starting and killing processes continuosly |
Looking at logs from a Net-Server Prefork daemon:
Mar 22 23:55:42 filterpd: filterpd[2234]: Processing diff (0), Waiting
diff (-1)
Mar 22 23:56:12 filterpd: filterpd[2234]: Killing \"1\" children
Mar 22 23:56:12 filterpd: filterpd[2454]: Exiting child process after
handling 0 requests
Mar 22 23:56:12 filterpd: filterpd[2234]: Starting \"1\" children
Mar 22 23:56:12 filterpd: filterpd[2591]: Child Preforked (2591)
Mar 22 23:56:22 filterpd: filterpd[2234]: Processing diff (0), Waiting
diff (-1)
Mar 22 23:56:32 filterpd: filterpd[2234]: Killing \"1\" children
Mar 22 23:56:32 filterpd: filterpd[2591]: Exiting child process after
handling 0 requests
Mar 22 23:56:32 filterpd: filterpd[2234]: Starting \"1\" children
Mar 22 23:56:32 filterpd: filterpd[2592]: Child Preforked (2592)
Problem is that childrens change status but the global counters are not
changed accordingly, so parent believes there are less children than
really are, starting a children. Later the children is killed and so on.
Attached is a patch.
Subject: | Net-Server_095_PreFork.pm |
--- lib/Net/Server/PreFork.pm 2007-02-03 06:38:32.000000000 +0100
+++ /usr/lib64/perl5/site_perl/5.8.8/Net/Server/PreFork.pm 2007-03-23 01:40:19.000000000 +0100
@@ -356,10 +356,12 @@
if( $status eq 'processing' ){
$prop->{tally}->{processing} ++;
+ $prop->{tally}->{waiting} --;
$prop->{last_process} = time();
}elsif( $status eq 'waiting' ){
$prop->{tally}->{processing} --;
+ $prop->{tally}->{waiting} ++;
}elsif( $status eq 'exiting' ){
$self->delete_child($pid);