You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Paul Silevitch <pa...@silevitch.com> on 2015/12/26 20:37:55 UTC

CleanupHandler not always running

Hello Mod_perl-ers,

I've got an app that increments a counter in redis in a
PostReadRequestHandler and decrements it in a CleanupHandler.  I'm noticing
a small amount of cases where the counter doesn't get decremented.  There
are no segfaults but there are a small number of "Apache2::Filter internal
flush: (-3) Unknown error 4294967293 at -e line 0" messages.  Looking at
the source code, I believe a modperl_croak is getting called in this case.
Would this cause the CleanupHandler to not run?  What exactly happens when
modperl_croak is called?

Thanks,

Paul

Re: CleanupHandler not always running

Posted by Paul Silevitch <pa...@silevitch.com>.
I figured this out.  We use mod_proxy and in the case where there's a proxy
error, PostReadRequestHandler is executed twice (once for the original
request before proxying and once for the 50x error generated by
mod_proxy).  By checking $r->status, I can make sure that the code that
increments in PostReadRequestHandler is only called once.

Paul

On Sun, Dec 27, 2015 at 10:41 AM, Paul Silevitch <pa...@silevitch.com> wrote:

> Philippe,
>
> I think you are on to something.  We use graceful-stops and we reset the
> counters during a subsequent start.  It looks like the counters sometimes
> come out of the graceful-stop / start with an elevated number which
> supports your theory.  Do you recommend using a LogHandler instead of a
> CleanupHandler?
>
> Thanks!
>
> Paul
>
> On Sat, Dec 26, 2015 at 7:33 PM, Philippe Chiasson <go...@ectoplasm.org>
> wrote:
>
>> Could be the result of shutdown or graceful restarts. CleanupHandlers are
>> synthetic to mod_perl and are not specifically supported/guaranteed by httpd
>>
>> See
>> https://perl.apache.org/docs/2.0/user/handlers/http.html#Possible_Caveats
>>
>> Sent from my iPhone
>>
>> On Dec 26, 2015, at 14:37, Paul Silevitch <pa...@silevitch.com> wrote:
>>
>> Hello Mod_perl-ers,
>>
>> I've got an app that increments a counter in redis in a
>> PostReadRequestHandler and decrements it in a CleanupHandler.  I'm noticing
>> a small amount of cases where the counter doesn't get decremented.  There
>> are no segfaults but there are a small number of "Apache2::Filter
>> internal flush: (-3) Unknown error 4294967293 at -e line 0" messages.
>> Looking at the source code, I believe a modperl_croak is getting called in
>> this case.  Would this cause the CleanupHandler to not run?  What exactly
>> happens when modperl_croak is called?
>>
>> Thanks,
>>
>> Paul
>>
>>
>

Re: CleanupHandler not always running

Posted by Paul Silevitch <pa...@silevitch.com>.
Philippe,

I think you are on to something.  We use graceful-stops and we reset the
counters during a subsequent start.  It looks like the counters sometimes
come out of the graceful-stop / start with an elevated number which
supports your theory.  Do you recommend using a LogHandler instead of a
CleanupHandler?

Thanks!

Paul

On Sat, Dec 26, 2015 at 7:33 PM, Philippe Chiasson <go...@ectoplasm.org>
wrote:

> Could be the result of shutdown or graceful restarts. CleanupHandlers are
> synthetic to mod_perl and are not specifically supported/guaranteed by httpd
>
> See
> https://perl.apache.org/docs/2.0/user/handlers/http.html#Possible_Caveats
>
> Sent from my iPhone
>
> On Dec 26, 2015, at 14:37, Paul Silevitch <pa...@silevitch.com> wrote:
>
> Hello Mod_perl-ers,
>
> I've got an app that increments a counter in redis in a
> PostReadRequestHandler and decrements it in a CleanupHandler.  I'm noticing
> a small amount of cases where the counter doesn't get decremented.  There
> are no segfaults but there are a small number of "Apache2::Filter
> internal flush: (-3) Unknown error 4294967293 at -e line 0" messages.
> Looking at the source code, I believe a modperl_croak is getting called in
> this case.  Would this cause the CleanupHandler to not run?  What exactly
> happens when modperl_croak is called?
>
> Thanks,
>
> Paul
>
>

Re: CleanupHandler not always running

Posted by Philippe Chiasson <go...@ectoplasm.org>.
Could be the result of shutdown or graceful restarts. CleanupHandlers are synthetic to mod_perl and are not specifically supported/guaranteed by httpd

See https://perl.apache.org/docs/2.0/user/handlers/http.html#Possible_Caveats

Sent from my iPhone

> On Dec 26, 2015, at 14:37, Paul Silevitch <pa...@silevitch.com> wrote:
> 
> Hello Mod_perl-ers,
> 
> I've got an app that increments a counter in redis in a PostReadRequestHandler and decrements it in a CleanupHandler.  I'm noticing a small amount of cases where the counter doesn't get decremented.  There are no segfaults but there are a small number of "Apache2::Filter internal flush: (-3) Unknown error 4294967293 at -e line 0" messages.  Looking at the source code, I believe a modperl_croak is getting called in this case.  Would this cause the CleanupHandler to not run?  What exactly happens when modperl_croak is called?
> 
> Thanks,
> 
> Paul
>