You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Graham Barr <gb...@pobox.com> on 2002/07/18 16:41:36 UTC

[QUESTION] mod_perl skipping phases

I am not subscribed to the list, so please copy me on any replies.

We have recently upgraded to the latest 1.3.x apache and mod_perl
and our code is flagging a warning that it did not before.

I am hoping it is the result of a bug fixed in Apache or mod_perl
and that I can change our code to detect and ignore it.

It seems that sometimes some phases of a request are skipped and
the cleanup handler is called.

We have a PerlHeaderParserHandler which gathers all sorts of
information and stores it in pnotes, and later handlers use this
information.

However after the upgrade we occasionally, and it is rare, get a
warning from the cleanup handler that the data structure is not
present in pnotes, which makes me think that the PerlHeaderParserHandler
is not being called.

In an attempt to see what was causing this I added a
  warn $r->as_string
into the cleanup handler. The request looked valid enough, but
there were two things I noticed.

1. This only ever happens on a POST request

2. The response section was always 

  HTTP/1.1 (null)

This make me think that the content handler is not being called
either.

Our system is setup with a lightweight front end apache which proxies
requests to a backend mod_perl server.

Does anyone know of a circumstance that this can happen ?

Thanks,
Graham.

Re: [QUESTION] mod_perl skipping phases

Posted by Ask Bjoern Hansen <as...@develooper.com>.
On Fri, 19 Jul 2002, Geoffrey Young wrote:

> > In an attempt to see what was causing this I added a
> >   warn $r->as_string
> > into the cleanup handler. The request looked valid enough, but
> > there were two things I noticed.
> >
> > 1. This only ever happens on a POST request
> >
> > 2. The response section was always
> >
> >   HTTP/1.1 (null)
[...]
> speaking of which, I wonder if your issue has something to do with
> internal redirects.  the cleanup handler could be looking in
> $r->pnotes but your data is in $r->main->pnotes.  try a construct like

I'm pretty sure the code that is giving Graham trouble doesn't do
any internal redirects.

Graham, maybe using ->last on $r in Apache::DumpHeaders would make a
difference.  (Completely untested).

$ diff -u plain DumpHeaders.pm
--- plain	Sun Jul 21 00:27:26 2002
+++ DumpHeaders.pm	Sun Jul 21 00:27:08 2002
@@ -7,7 +7,7 @@
 $VERSION = "0.94";

 sub handler {
-  my $r = shift;
+  my $r = shift->last;
   my $note = $r->notes("DumpHeaders");
   if ($r->dir_config("DumpHeaders_Conditional")) {
     return DECLINED unless $note;


  - ask

-- 
ask bjoern hansen, http://askbjoernhansen.com/ !try; do();


Re: [QUESTION] mod_perl skipping phases

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> In an attempt to see what was causing this I added a
>   warn $r->as_string
> into the cleanup handler. The request looked valid enough, but
> there were two things I noticed.
> 
> 1. This only ever happens on a POST request
> 
> 2. The response section was always 
> 
>   HTTP/1.1 (null)


I think the (null) is a bug in $r->as_string and/or Apache.  see

  http://use.perl.org/~geoff/journal/766

for some random thoughts there.

speaking of which, I wonder if your issue has something to do with 
internal redirects.  the cleanup handler could be looking in 
$r->pnotes but your data is in $r->main->pnotes.  try a construct like

   my $note = ($r->prev||$r)->pnotes('Foo');

and see if that helps.

I dunno if any behavior related to internal redirect changed in recent 
versions of Apache and/or mod_perl, but it might be worth a looking in 
other places for the data (like $r->prev), rather than thinking some 
handler isn't being run.


HTH

--Geoff