You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Adolph Torres <kh...@earthlink.net> on 2003/08/22 01:07:29 UTC
RE: ModPerl2/Apache2 - Error handling return codes -RegistryCooker.pm:"Argument "" isn't numeric ...& bottom of web page say:OK the server encounteredan internal .....
Hello,
That did it! I'll make sure to watch for that pointer reference in
the future. The error_log is now clean and the OK message is not appearing
on pages. And if I ever see that in some online venue I'll make sure
to pass this info on.
Best Regards,
Adolph Torres
khmb1@earthlink.net
----- Original Message -----
From: Randy Kobes
To: Adolph Torres
Cc: dev@perl.apache.org
Sent: 8/21/2003 1:18:51 PM
Subject: RE: ModPerl2/Apache2 - Error
handling return codes -RegistryCooker.pm:"Argument "" isn't numeric ...
bottom of web page say:OK the server encounteredan internal .....
On Thu, 21 Aug 2003, Adolph Torres wrote:
Below is the slimmed down script (script1.pl) to reproduce
the same error. This script is supposed to accept
form
input of all types (char, boolean, numeric,
etc). Couple
things to note: Neither edit changed the error message
in
error_log nor prevented the OK msg from popping up (and I
did restart httpd). Bummer. Also, I changed the script
to
not accept input (see script2.pl) - just run through a
loop and put something onto the screen - and that worked
fine.
In doing that it became apparent my problem has something to do
with
the $#in in the foreach
statement: foreach $i
(0 .. $#in) { ...}
[ .. ]
--------------------------
script1.pl
--------------------------
#!/usr/bin/perl -w
print "Content-Type: text/html\n\n";
use strict;
our $in;
our $key;
our $val;
our $i;
our @listing;
our
@in;
[ ... ]
local (*in) = @_ if @_;
Does it help if you comment out this line?
--
best regards,
--- Adolph Torres
--- khmb1@earthlink.net
--- EarthLink: It's your Internet.
Re: ModPerl2/Apache2 - Error handling return codes -RegistryCooker.pm:"Argument
"" isn't numeric ...& bottom of web page say:OK the server encounteredan
internal .....
Posted by Stas Bekman <st...@stason.org>.
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
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org