Loading ...
Sorry, an error occurred while loading the content.

Re: [mp1] Method handler that eventually seems to "forget" it's a method handler

Expand Messages
  • Martin Moss
    I ve seen this problem and never got to the bottom of it, on a redhat box with 5.8.3 (I think) and same apache and mod_perl, Marty ...
    Message 1 of 7 , Feb 2, 2005
    • 0 Attachment
      I've seen this problem and never got to the bottom of
      it, on a redhat box with 5.8.3 (I think) and same
      apache and mod_perl,

      Marty




      --- Andrew Green <andrew@...> wrote:
      > Hi,
      >
      > I seem to have a bizarre problem with method
      > handlers on my setup. I
      > have a set of different handlers, all of which are
      > method handlers so
      > that I can easily inherit shared code across a
      > collection of different
      > installations of my application on the same server.
      >
      > The first handler to get invoked is a
      > PerlTransHandler -- everything
      > works fine (or at least seems to) for quite some
      > time, but then the
      > handler begins "forgetting" that it's a method
      > handler, and instead of
      > the class being passed before $r, $r becomes the
      > first thing passed.
      > At least, that seems to be what's happening. Is
      > this a known problem?
      >
      > My setup is as follows:
      >
      > Perl 5.8.0 (Red Hat EL 3 default)
      > Apache/1.3.29
      > mod_perl/1.29
      >
      >
      > Here's what I imagine to be the relevant bits of
      > httpd.conf:
      >
      > MinSpareServers 10
      > MaxSpareServers 20
      > StartServers 10
      > MaxClients 60
      > MaxRequestsPerChild 1000
      > ...
      > <VirtualHost xxx>
      > PerlTransHandler MyApp::MyInstall::Dispatcher
      > ...
      >
      >
      > Here's the relevant bits of Dispatcher.pm:
      >
      > package MyApp::MyInstall::Dispatcher;
      >
      > use strict;
      > use Apache::Constants qw(OK DECLINED NOT_FOUND
      > REDIRECT FORBIDDEN);
      > use Apache::URI;
      >
      > our @ISA = qw(MyApp::Core::Dispatcher);
      >
      > 1;
      >
      > ####
      >
      > sub handler ($$) {
      >
      > my ($class,$r) = @_;
      > return DECLINED unless ($r->is_initial_req());
      > ...
      >
      >
      > And here's the error (that only starts appearing
      > after the server's
      > been running for a while:
      >
      > Can't call method "is_initial_req" on an undefined
      > value...
      >
      > The error then points to the line quoted above. Of
      > course, Apache
      > never gets to other handlers later in the sequence,
      > so I can't easily
      > see whether the problem is limited to TransHandlers,
      > or whether all my
      > method handlers would stop acting as such.
      > Restarting the server makes
      > the problem go away -- for a while!
      >
      > I'd really like to avoid having to upgrade/change
      > Perl or mod_perl if
      > at all possible. Nonetheless, any help, advice or
      > guidance anyone can
      > provide would be very much appreciated.
      >
      > Cheers,
      > Andrew.
      >





      ___________________________________________________________
      ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com
    • Martin Moss
      I tried - handler in my configs, made no difference. I was doing a require in a startup script if that makes any difference. Haven t seen this issue with
      Message 2 of 7 , Feb 2, 2005
      • 0 Attachment
        I tried ->handler in my configs, made no difference.
        I was doing a 'require' in a startup script if that
        makes any difference. Haven't seen this issue with
        simillar code anywhere else..

        Marty

        --- Geoffrey Young <geoff@...> wrote:

        >
        > > <VirtualHost xxx>
        > > PerlTransHandler MyApp::MyInstall::Dispatcher
        >
        > make that
        >
        > PerlTransHandler
        > MyApp::MyInstall::Dispatcher->handler
        >
        > and see if that helps. you should also be
        > preloading via
        >
        > PerlModule MyApp::MyInstall::Dispatcher
        >
        > or in a startup.pl.
        >
        > HTH
        >
        > --Geoff
        >





        ___________________________________________________________
        ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com
      • Geoffrey Young
        ... and for those that don t go and read the links, while the above form isn t valid you should be able to use this instead. $r- push_handlers(
        Message 3 of 7 , Feb 2, 2005
        • 0 Attachment
          >>I'll give that a go and see. Is the following also kosher, then?
          >>
          >> $r->push_handlers(
          >> PerlCleanupHandler => MyApp::MyInstall::Cleaner->handler
          >> );
          >
          >
          > sorry, no - you can't currently push a method handler like that. see the
          >
          > * method handler cached-CVs
          >
          > entry in the STATUS file that ships with mod_perl-1.0 for some relevant links.

          and for those that don't go and read the links, while the above form isn't
          valid you should be able to use this instead.

          $r->push_handlers(
          PerlCleanupHandler => 'MyApp::MyInstall::Cleaner->handler'
          );

          (note the quotes)

          --Geoff
        Your message has been successfully submitted and would be delivered to recipients shortly.