You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "John E. Leon Guerrero" <jg...@live365.com> on 2002/05/11 01:54:47 UTC

how to see /server-status when at MaxClients?

if a job hangs (due to database locking for instance), then a mod_perl child
will hang as well (absent some additional watchdog-type program.)  if enough
jobs hang to the point that we hit MaxClients, then it is too late to use
/server-status to see what jobs hung.

does anyone have a quick way to indentify the jobs that are currently
running?  i thought of getting a core and using gdb but i was hoping to find
a faster way.  it would be nice if we could reserve a couple of children for
administrative emergencies such as this.

thanks,
jlg

John Leon Guerrero -- http://www.live365.com



Re: how to see /server-status when at MaxClients?

Posted by Stas Bekman <st...@stason.org>.
John E. Leon Guerrero wrote:
> if a job hangs (due to database locking for instance), then a mod_perl child
> will hang as well (absent some additional watchdog-type program.)  if enough
> jobs hang to the point that we hit MaxClients, then it is too late to use
> /server-status to see what jobs hung.
> 
> does anyone have a quick way to indentify the jobs that are currently
> running?  i thought of getting a core and using gdb but i was hoping to find
> a faster way.  it would be nice if we could reserve a couple of children for
> administrative emergencies such as this.

You probably want: Apache::Watchdog::RunAway

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: how to see /server-status when at MaxClients?

Posted by Andrew McNaughton <an...@scoop.co.nz>.

On Fri, 10 May 2002, John E. Leon Guerrero wrote:

> Date: Fri, 10 May 2002 16:54:47 -0700
> From: John E. Leon Guerrero <jg...@live365.com>
> To: modperl@apache.org
> Subject: how to see /server-status when at MaxClients?
>
> if a job hangs (due to database locking for instance), then a mod_perl child
> will hang as well (absent some additional watchdog-type program.)  if enough
> jobs hang to the point that we hit MaxClients, then it is too late to use
> /server-status to see what jobs hung.
>
> does anyone have a quick way to indentify the jobs that are currently
> running?  i thought of getting a core and using gdb but i was hoping to find
> a faster way.  it would be nice if we could reserve a couple of children for
> administrative emergencies such as this.

Some possible approaches:

1) If your problem is with database locking, then it may be better to
treat the problem within the database - kill the database thread, or
perhaps there's some sort of timeout you can mess with.  Depending on what
database you are using, you may have useful diagnostics for identifying
the problem threads.  You also get the chance to have your mod_perl
process handle the failure a bit more gracefully than if it was simply
killed.  You need to make sure that your apache processes will
restart the database connection where required.

2) If you're prepared to get your hands dirty (albeit probably less dirty
than they'd be after playing around with core files), and depending what
operating system you are running, then you could modify the apache source
code so that the shared memory used for the scoreboard is left available
as a file which you could mmap from an external process.

I haven't tried this, but having had a quick peek at the sources, I'll
point you to the bits that looked useful.

In src/main/http_main.c, look for the flag "MAP_TMPFILE".  It looks as
though that's only turned on for MacOS X (in src/include/ap_config.h), but
I expect that it would work on several other operating systems if you
turned it on.  Looking at the code that's turned on by that flag, you want
to take out the line where the file is unlinked and probably add some
cleanup code elsewhere.  You might choose to change the way the file name
is generated, or you might just log the filename so that an external
program can find the dynamically named temp file.

You then write yourself a little program which mmaps the same file, and
which borrows code from apache in order to read it.

Andrew