Hi,
Recently there were a few questions regarding hanging processes, I've
tried to reproduce this case and have found two problems.
Let's take a little script that obviously "hangs" the server:
my $r = shift;
$r->send_http_header('text/plain');
$|=1; # so we would see the $$ printed
print "OK $$\n";
sleep 1, $i++ while 1;
First question is: how do I detect that some server hangs? I've tried top,
ps, /server-status -- none of them helped me to find that some process
hangs. Of course if the process uses lot of resources you can bust it, by
watching the top(), another approach is to use /server-status and watch it
for about 5-10 minutes spotting which process number has the same number
of requests while its status is 'W' (Which means that it hangs), but when
you have about 50 procs, it's quite hard to spot such a process.
Another easy spotting is when some process trashes the error_log and
writes millions of error messages there... But you still don't know the
PID of this process, so you just restart all of them.
So my question is, is there any way to tell that some process hangs?
Those who reported their processes hang, how did you spot it?
If I knew a programmatical way to spot the hanging process, I'd implement
it in Apache::VMonitor to warn the admin and it would be possible to run
watchdogs to kill off the process and report to admin... I think it would
be a useful addon for us...
The second question is how comes that the above little script never quits
after the stop button was pressed? Apache was supposed to detect SIGPIPE
and abort the run... but it doesn't - it's very easy to reproduce - just
run it... I've used $|=1 to print the $$ and check that it really hangs...
Thanks!
_______________________________________________________________________
Stas Bekman mailto:[EMAIL PROTECTED] www.singlesheaven.com/stas
Perl,CGI,Apache,Linux,Web,Java,PC at www.singlesheaven.com/stas/TULARC
www.apache.org & www.perl.com == www.modperl.com || perl.apache.org
single o-> + single o-+ = singlesheaven http://www.singlesheaven.com