Fri Aug 22 10:37:59 PDT 2003
Hello again,
Here is the result of those edits on this system.  And I'm more than willing to continue working this if you would like - but had to back it out as you'll see below.

Adolph Torres
[EMAIL PROTECTED]
-------------------------------------------------------------------------------


#-> Snip of new edit to RegistryCooker.pm:

    { # run the code and preserve warnings setup when it's done
        no warnings;
        my $r_iv=$$r;#people do things...
        eval{$cv->($r,@_)};
        unless(ref($r) eq 'SCALAR' && $$r==$r_iv){
          warn "dude, your just killed \$r!($self->{FILENAME})\n";
          $$r=$r_iv;#restore the IV slot
        ModPerl::Global::special_list_call(END => $package);
    }
--------------------------------------------------------------------------------------
#-> Restart of Apache (hton is my alias for apachectl startssl) failed with the following:

[EMAIL PROTECTED] mysql]# hton
[Fri Aug 22 09:53:02 2003] [error] Variable "%switches" will not stay shared at /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Apache2/ModPerl/RegistryCooker.pm line 572.
Compilation failed in require at (eval 3) line 3.
        ...propagated at /usr/lib/perl5/5.8.0/base.pm line 64.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Apache2/ModPerl/Registry.pm line 11.
Compilation failed in require at /usr/local/httpd/prefork//startup.pl line 16.
BEGIN failed--compilation aborted at /usr/local/httpd/prefork//startup.pl line 16.
Compilation failed in require at (eval 1) line 1.

[Fri Aug 22 09:53:02 2003] [error] Can't load Perl file: startup.pl for server huffnpuff:80, exiting...
-----------------------------------------------------------------------------------------------------------
#-> After commenting out the 'use Apache::Registry' (line 16) in startup.pl the server started w/o error. 
------------------------------------------------------------------------------------------------------
#-> Ran script1.pl (the one with the OK msg error from before) and it failed with:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.....
----------------------------------------------------------------------------------------------------
#-> error_log reported:

[Fri Aug 22 10:19:19 2003] [error] failed to resolve handler `ModPerl::Registry'
[Fri Aug 22 10:19:19 2003] [error] [client 127.0.0.1] Variable "%switches" will not stay shared at /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Apache2/ModPerl/RegistryCooker.pm line 572.
Compilation failed in require at (eval 7) line 3.
        ...propagated at /usr/lib/perl5/5.8.0/base.pm line 64.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Apache2/ModPerl/Registry.pm line 11.
Compilation failed in require at (eval 6) line 3.

--------------------------------------------------------------------------------------------------------
#-> Running script2.pl (the one working after taking the pntr ref out) - same error:

[Fri Aug 22 10:21:01 2003] [error] failed to resolve handler `ModPerl::Registry'
[Fri Aug 22 10:21:01 2003] [error] [client 127.0.0.1] Variable "%switches" will not stay shared at /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Apache2/ModPerl/RegistryCooker.pm line 572.
Compilation failed in require at (eval 7) line 3.
        ...propagated at /usr/lib/perl5/5.8.0/base.pm line 64.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/Apache2/ModPerl/Registry.pm line 11.
Compilation failed in require at (eval 6) line 3.

--------------------------------------------------------------------------------
#-> Here's my httpd.conf for mod_perl:

PerlModule Apache2
PerlModule CGI::Cookie
PerlSetEnv MOD_PERL_TRACE all

# Added for regular cgi's  - 8.3.3
Alias /cgi-bin/ "/var/www/cgi-bin/"
<Directory "/var/www/cgi-bin/">
      SetHandler perl-script
      PerlResponseHandler ModPerl::Registry
      PerlOptions +ParseHeaders
      PerlSendHeader On
      Options +ExecCGI
</Directory>

# Added for secured-scripts (SSL) -  8.4.3
Alias /sec/ /var/www/sec/
<Location /sec/>
      SetHandler perl-script
      PerlResponseHandler ModPerl::Registry
      PerlOptions +ParseHeaders
      PerlSendHeader On
      Options +ExecCGI
</Location>

# Added for startup.pl - 8.4.3
 PerlRequire startup.pl

# Added for perl-status - 8.5.3
 <Location /perl-status>
      SetHandler perl-script
      PerlResponseHandler Apache::Status
      PerlOptions +GlobalRequest
      PerlSendHeader on
  </Location>
 
# added as a test module - 8.18.3 ajt
PerlModule Test::Cookie
  <Location /Test/Cookie>
    SetHandler perl-script
    PerlHandler Test::Cookie
  </Location>


 
----- Original Message -----
From: Stas Bekman
To: [EMAIL PROTECTED]
Sent: 8/22/2003 12:33:26 AM
Subject: Re: ModPerl2/Apache2 - Error handling return codes -RegistryCooker.pm:"Argument"" isn't numeric ...& bottom of web page say:OK the server encounteredaninternal .....

I'd still like to resolve this issue, here is the minimalistic registry script
that reproduces the problem:
 
local (*in) = @_;
$in = 5;
 
this gets wrapped as:
 
sub handler {
   local (*in) = @_;
   $in = 5;
}
 
and then called as:
 
handler($r);
 
so the above code corrupts the guts $r, while keeping it a valid object.
 
Here is Devel::Peek::Dump($r) before the above handler is called:
 
SV = RV(0x82c8cb8) at 0x81bcab0
   REFCNT = 1
   FLAGS = (PADBUSY,PADMY,ROK)
   RV = 0x853a4c8
   SV = PVMG(0x88d3190) at 0x853a4c8
     REFCNT = 5
     FLAGS = (OBJECT,IOK,pIOK)
     IV = 143444264
     NV = 0
     PV = 0
     STASH = 0x81de51c   "Apache::RequestRec"
 
Here it is after:
 
SV = RV(0x82c8cb8) at 0x81bcab0
   REFCNT = 1
   FLAGS = (PADBUSY,PADMY,ROK)
   RV = 0x853a4c8
   SV = PVMG(0x88d3190) at 0x853a4c8
     REFCNT = 5
     FLAGS = (OBJECT,IOK,pIOK)
     IV = 5
     NV = 0
     PV = 0
     STASH = 0x81de51c   "Apache::RequestRec"
 
as you can see it's essentially the same thing, but its IV slot which contains
a C reference to the real object is now corrupted (got the assignment). So
there is no way to check whether the object is valid. But luckily we can
dereference the object and preserve it guts, no matter what horrors are done
to it ;)
 
Here is my take on this issue
 
Index: lib/ModPerl/RegistryCooker.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/ModPerl-Registry/lib/ModPerl/RegistryCooker.pm,v
retrieving revision 1.35
diff -u -r1.35 RegistryCooker.pm
--- lib/ModPerl/RegistryCooker.pm 23 Mar 2003 04:52:24 -0000 1.35
+++ lib/ModPerl/RegistryCooker.pm 22 Aug 2003 07:30:27 -0000
@@ -181,7 +181,14 @@
 
      { # run the code and preserve warnings setup when it's done
          no warnings;
+
+        my $r_iv = $$r; # people do things...
          eval { $cv->($r, @_) };
+        unless (ref($r) eq 'SCALAR' && $$r == $r_iv) {
+            warn "dude, you just killed \$r! ($self->{FILENAME})\n";
+            $$r = $r_iv; # restore the IV slot
+        }
+
          ModPerl::Global::special_list_call(END => $package);
      }
 
Adolph, please try your old code that you posted here earlier, after you apply
this patch. RegistryCooker shouldn't be affected anylonger.
 
I'm not sure whether we should apply this patch. Comments?
 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
 

 
--- Adolph Torres
--- [EMAIL PROTECTED]
--- EarthLink: It's your Internet.
 

Reply via email to