Hi folks,
recently I deployed Apache::SizeLimit on a mod_perl 1.29
machine running SLES 9, since we had - ehm - runaway
processes....
After a while I stumbled across messages like
this:
/var/web/logs/error_log_modperl.3:[Tue May 17 20:45:04 2005]
(21886) Apache::SizeLimit main process too big, SIZE=2003764 KB
SHARE=21208 KB
/var/web/logs/error_log_modperl.3:[Tue May 17 20:56:49 2005] (21886) Apache::SizeLimit main process too big, SIZE=2003764 KB SHARE=21208 KB
/var/web/logs/error_log_modperl.3:[Tue May 17 21:02:42 2005] (21886) Apache::SizeLimit main process too big, SIZE=2003764 KB SHARE=21208 KB
/var/web/logs/error_log_modperl.3:[Tue May 17 21:07:02 2005] (21886) Apache::SizeLimit main process too big, SIZE=2003764 KB SHARE=21208 KB
/var/web/logs/error_log_modperl.3:[Tue May 17 20:56:49 2005] (21886) Apache::SizeLimit main process too big, SIZE=2003764 KB SHARE=21208 KB
/var/web/logs/error_log_modperl.3:[Tue May 17 21:02:42 2005] (21886) Apache::SizeLimit main process too big, SIZE=2003764 KB SHARE=21208 KB
/var/web/logs/error_log_modperl.3:[Tue May 17 21:07:02 2005] (21886) Apache::SizeLimit main process too big, SIZE=2003764 KB SHARE=21208 KB
and eventually read them in a way that actually hit my brain
and I though: why does the main process grow and why is it serving requests ? I
registered Apache::SizeLimit as a PerlCleanupHandler, so it should only be
called for requests, right ? So I looked at the code and saw
this:
# wake up! time to
die.
if ($WIN32 || (getppid > 1)) { # this is a child httpd
my $e = time - $START_TIME;
my $msg = "httpd process too big, exiting at SIZE=$size KB ";
$msg .= " SHARE=$share KB " if ($share);
$msg .= " REQUESTS=$REQUEST_COUNT LIFETIME=$e seconds";
error_log($msg);
if ($WIN32 || (getppid > 1)) { # this is a child httpd
my $e = time - $START_TIME;
my $msg = "httpd process too big, exiting at SIZE=$size KB ";
$msg .= " SHARE=$share KB " if ($share);
$msg .= " REQUESTS=$REQUEST_COUNT LIFETIME=$e seconds";
error_log($msg);
if ($WIN32)
{
CORE::exit(-2); # child_terminate() is disabled in win32 Apache
} else {
$r->child_terminate();
}
CORE::exit(-2); # child_terminate() is disabled in win32 Apache
} else {
$r->child_terminate();
}
} else
{ # this is the main httpd, whose parent is
init?
my $msg = "main process too big, SIZE=$size KB ";
$msg .= " SHARE=$share KB" if ($share);
error_log($msg);
}
my $msg = "main process too big, SIZE=$size KB ";
$msg .= " SHARE=$share KB" if ($share);
error_log($msg);
}
I claim, the "main process " detection does never work and
does not make sense. Why? Not even when the apache is started on boot through
init, the PPID will be 1, but some shell / rc pid. You can only find the
PPID in the PID file that apache writes. But still: this should never be the
case - right ?
I checked Apache::SizeLimit for mod_perl 2 and found it mostly
unchanged, so maybe this should be updated as:
- if I am wrong and the main process goes through the cleanup
phase, then we should read the PID file once at startup and test $$ against that
PID
- if I am right, then the whole getppid stuff can just go
away
What do you think ?
For my problem: I think that somehow the getppid does not work
correctly with my perl 5.8.3 SLES9 / mp 1.29 / apache 1.3.29 combination ->
I`ll try to scrap the getppid test and see, if the server will ever get
killed...
cheers
Andreas
Nolte
Leitung
IT
-----------------------------------------------------------
arvato
direct services
Olympiastraße 1
26419 Schortens
Germany
http://www.arvato.com/
[EMAIL PROTECTED]
Phone +49 (0) 4421 - 76-
84002
Fax +49 (0) 4421 - 76-
84111
Andreas Nolte
Leitung
IT
-----------------------------------------------------------
arvato
direct services
Olympiastraße 1
26419 Schortens
Germany
http://www.arvato.com/
[EMAIL PROTECTED]
Phone
+49 (0) 4421 - 76- 84002
Fax +49 (0) 4421 - 76-
84111