[prev in list] [next in list] [prev in thread] [next in thread]
List: apache-modperl
Subject: Re: Even more on the register_cleanup bug
From: Oleg Bartunov <oleg () sai ! msu ! su>
Date: 1999-06-30 17:22:16
[Download RAW message or body]
Ooh,
I was to quick :-( My problem is still alive
I tested wrong URL which worked fine before.
Regards,
Oleg
On Wed, 30 Jun 1999, Oleg Bartunov wrote:
> Date: Wed, 30 Jun 1999 20:06:08 +0400 (MSD)
> From: Oleg Bartunov <oleg@sai.msu.su>
> To: Chip Turner <chip@zfx.com>
> Cc: modperl <modperl@apache.org>, dougm@perl.apache.org, E.Mergl@bawue.de
> Subject: Re: Even more on the register_cleanup bug
>
> Whoa,
>
> it seems this patch is a good medicine for my problem.
> I didn't test it very much but now ApacheDBI works fine !
> It's strange a bit that it worked on FreeBSD without this patch.
>
> Regards,
> Oleg
>
> On Wed, 30 Jun 1999, Chip Turner wrote:
>
> > Date: Wed, 30 Jun 1999 15:38:20 +0000
> > From: Chip Turner <chip@zfx.com>
> > To: modperl <modperl@apache.org>
> > Cc: dougm@perl.apache.org
> > Subject: Even more on the register_cleanup bug
> >
> >
> > I've been narrowing down the bug I've posted about before, and though
> > I've not been able to reproduce it on a clean box, I've seen it happen
> > on at least two different boxes here where I work. A patch is included
> > that fixed the problem here.
> >
> > I've done some more testing, and here's what I can confirm:
> >
> > PerlCleanupHandler behaves correctly
> > PerlLoggingHandler behaves correctly
> > Apache->request->register_cleanup does NOT behave correctly
> >
> > Here's a snippet of code:
> > sub handler {
> > my $r = shift;
> > return Apache::Constants::DECLINED unless
> > ($r->content_type() eq 'text/parthenon' or $r->content_type() eq
> > 'text/html');
> >
> > # Apache->request->register_cleanup(sub { warn "Apache/mod_perl cleanup
> > 1" });
> >
> > $r->register_cleanup(sub { warn "Apache/mod_perl true cleanup, pid $$"
> > });
> > $r->push_handlers( PerlLogHandler => sub { warn "Apache/mod_perl
> > logging cleanup, pid $$" });
> >
> > This code registers two cleanups that report to the error log. Also,
> > there is a function:
> > sub handler {
> > warn "Apache/mod_perl conf cleanup, pid $$";
> > }
> >
> > In the appropriate package that is initialized like:
> > PerlCleanupHandler Parthenon::Apache::cleanup
> >
> > Watching the error logs and running ab results in the following.
> >
> > Before ab:
> >
> > Conf: 768
> > Internal: 338
> > Logging: 1515
> >
> > Then after 'ab -n 100 -c 5 http://(site)/' is executed, we get:
> >
> > Conf: 872
> > Internal: 348
> > Logging: 1619
> >
> >
> > These numbers come from the following command:
> > echo -n "Conf: "; grep "conf cleanup" /etc/httpd/logs/(site).error |
> > grep pid | wc -l;
> > echo -n "Internal: "; grep "true cleanup" /etc/httpd/logs/(site).error |
> > grep pid | wc -l;
> > echo -n "Logging: "; grep "logging cleanup" /etc/httpd/logs/(site).error
> > | grep pid | wc -l
> >
> > As we see, PerlConfHandler and PerlLogHandler both report 104 cleanups
> > for 100 requests (the extra 4 are from ab; it seems to actually initiate
> > 104 requests with c set to 5. I've seen it request 109 when c is 10).
> > But we see only 10 calls to the cleanup made by register_cleanup! This
> > is on a clean restart of the server no less. The problem is definitely
> > being exacerbated somehow by what the site is calculating (since my last
> > report, a number of actions have been added to that page).
> >
> > After applying the patch below, all three numbers changed by the same
> > amount, 104. Apparently, by the time mod_perl_cleanup_handler in
> > mod_perl.c gets called, the global mp_request_req doesn't point to the
> > same value that it did when the cleanup was initally requested. That's
> > my theory, anyway. This patch fixes the problem:
> >
> > alpha:chip:src> diff -Naur mod_perl-1.20/src/modules/perl/mod_perl.c
> > mod_perl-1.20-patched/src/modules/perl/mod_perl.c
> > --- mod_perl-1.20/src/modules/perl/mod_perl.c Thu Jun 10 22:19:55 1999
> > +++ mod_perl-1.20-patched/src/modules/perl/mod_perl.c Wed Jun 30
> > 11:31:44 1999
> > @@ -1068,7 +1068,7 @@
> >
> > void mod_perl_cleanup_handler(void *data)
> > {
> > - request_rec *r = perl_request_rec(NULL);
> > + request_rec *r = data; // perl_request_rec(NULL);
> > SV *cv;
> > I32 i;
> > dPPDIR;
> >
> > I don't know if this should be a permanent fix or if there is a better
> > solution, but it seems to be working here on-site. Hope this is useful.
> >
> > (CC'd to Doug as a 'formal' patch/report)
> >
> > Chip
> >
> > --
> > Chip Turner chip@ZFx.com
> > Programmer, ZFx, Inc. www.zfx.com
> > PGP key available at wwwkeys.us.pgp.net
> >
>
> _____________________________________________________________
> Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
> Sternberg Astronomical Institute, Moscow University (Russia)
> Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
> phone: +007(095)939-16-83, +007(095)939-23-83
>
>
>
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic