You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by "Theo E. Schlossnagle" <je...@omniti.com> on 2003/01/21 17:51:56 UTC
$self->{asp} nor defined in Response?!
Hi, we run Apache::ASP on several largish sites...
Every once in a while, I get the following error in my error logs and it
causes either an internal server error or the page just not to load (depending
on whether or not the offense happens in an eval {} block).
We don't use $Response->Log() anywhere in our code, so it must be called by
Apache::ASP internals. Any ideas on why this is heppening or even better, how
to stop it?
[Tue Jan 21 11:23:45 2003] [error] [asp] [1638] [error] error compiling
flash.asp: Can't call method "Log" on an undefined value at
/usr/lib/perl5/site_perl/5.8.0/Apache/ASP/Response.pm line 105. <-->
Compilation failed in require at /path/to/flash.asp line 4. <--> BEGIN
failed--compilation aborted at /path/to/flash.asp line 4. <--> ,
/usr/lib/perl5/site_perl/5.8.0/Apache/ASP.pm line 1433
--
Theo Schlossnagle
Principal Consultant
OmniTI Computer Consulting, Inc. -- http://www.omniti.com/
1024D/82844984/95FD 30F1 489E 4613 F22E 491A 7E88 364C 8284 4984
2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: $self->{asp} nor defined in Response?!
Posted by Csongor Fagyal <co...@conceptonline.hu>.
> It is an Apache::ASP application. The only place $Response and
> $Request are ever used is in the .asp pages proper. No module
> requires them nor does it have any need to know about them. The code
> was developed from day one under mod_perl with Apache::ASP (v0.11)
> Over time, we have upgraded from perl 5 to perl 5.8.0 and brought
> Apache::ASP up to date as well. Some uses strict and some doesn't.
> The site works fine. It gets around 20 million .asp page loads a
> day. And Ihave these weird intermittent errors (like 1/10000 loads
> has this problem...)
Been there, done that :-) I have a third party domain registration API
which is *T*H*I*S* big, and is totally "unstrict". (Use strict did
help me, though...)
Let's see what Josh says about this. :-)
- Cs.
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: $self->{asp} nor defined in Response?!
Posted by "Theo E. Schlossnagle" <je...@omniti.com>.
Csongor Fagyal wrote:
> Well, the other thing is that Apache::ASP is mod_perl. You _must_
> rewrite "unclean" code if you want to use mod_perl. In general ,
> mod_perl code should be use strict compatible, there is little you can
> do about that. Probably you should write an Apache::ASP application, and
> call your modules outside the scope of ASP, if nothing else works.
It is an Apache::ASP application. The only place $Response and $Request are
ever used is in the .asp pages proper. No module requires them nor does it
have any need to know about them. The code was developed from day one under
mod_perl with Apache::ASP (v0.11) Over time, we have upgraded from perl 5 to
perl 5.8.0 and brought Apache::ASP up to date as well. Some uses strict and
some doesn't. The site works fine. It gets around 20 million .asp page loads
a day. And Ihave these weird intermittent errors (like 1/10000 loads has this
problem...)
--
Theo Schlossnagle
Principal Consultant
OmniTI Computer Consulting, Inc. -- http://www.omniti.com/
Phone: +1 410 872 4910 x201 Fax: +1 410 872 4911
1024D/82844984/95FD 30F1 489E 4613 F22E 491A 7E88 364C 8284 4984
2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: $self->{asp} nor defined in Response?!
Posted by Csongor Fagyal <co...@conceptonline.hu>.
Theo E. Schlossnagle wrote:
> Josh Chamas wrote:
>
>> This is when an old $Response object is no longer valid. This is
>> normally
>> caused by my closure or bad scoping issues.
>
>
> I assumed as much. However, it seems that:
> sub AppendToLog { shift->{asp}->Log(...); }
> should bde
> sub AppendToLog {
> my $self = shift;
> if($self && $self->{asp}) {
> $self->{asp}->Log(...);
> }
> }
>
> in Response.pm. Why? My $Response variable still exists and as I
> don't call Log directly it seems that it shouldn't return such a hard
> error (die) when Apache::ASP makes that call internally.
I have also noticed something like this previously, but that happened
with $Request->ServerVariables($name). Calling this function sometimes
resulted in a similar error you have experienced.
> I can do the later... But not the first. While we run both on almost
> all our code bases, this particular code base is a legacy one (written
> by another company) with over 200k lines of client .pm and .asp files.
> (over 100k of custom perl modules alone). So, retroactively adapting
> all legacy code to use strict is infeasible.
Well, the other thing is that Apache::ASP is mod_perl. You _must_
rewrite "unclean" code if you want to use mod_perl. In general ,
mod_perl code should be use strict compatible, there is little you can
do about that. Probably you should write an Apache::ASP application, and
call your modules outside the scope of ASP, if nothing else works.
- Csongor
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: $self->{asp} nor defined in Response?!
Posted by "Theo E. Schlossnagle" <je...@omniti.com>.
Josh Chamas wrote:
>
> If you call Apache::ASP->Load() on all the files, you can find the
> errors with UseStrict at compile time, so you do not get errors
> at runtime. The process of converting over to UseStrict will catch
> other errors besides the one that started this thread so would be
> good for the code base to be converted to using.
No doubt that use strict will help. That's why all coding projects we start
here require them (along with tons of other coding standards). However, since
we didn't write this code and as we are not being paid to convert all of it to
"use strict", the benefits of it, though understood, are irrelevant.
I zm unsure how I could wind up with a destroyed $Response object when
$Request and $Response aren't uned anywhere but in the .asp pages and are
never passed into functions or methods in the outlying codebase. So there
should be no caching of a $Response object for use after its life has ended.
--
Theo Schlossnagle
Principal Consultant
OmniTI Computer Consulting, Inc. -- http://www.omniti.com/
1024D/82844984/95FD 30F1 489E 4613 F22E 491A 7E88 364C 8284 4984
2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: $self->{asp} nor defined in Response?!
Posted by Josh Chamas <jo...@chamas.com>.
Old $Response objects being cached by compiled code comes up
for things like subroutines being used in scripts.
Please see
http://www.apache-asp.org/style.html#Do%20not%20definc430b103
This is what I mean when mentioning using UseStrict and PerlWarn
to catch these closure problems. The problem more generally has
to do with closure & scoping issues.
If this does not have to do with subs defined in scripts then
please post the script that is having these errors as this might
shed some light.
--Josh
George Schlossnagle wrote:
>
> On Tuesday, January 21, 2003, at 02:53 PM, Josh Chamas wrote:
>
>> Theo E. Schlossnagle wrote:
>>
>>> Josh Chamas wrote:
>>>
>>>> This is when an old $Response object is no longer valid. This is
>>>> normally
>>>> caused by my closure or bad scoping issues.
>>>
>>> I assumed as much. However, it seems that:
>>> sub AppendToLog { shift->{asp}->Log(...); }
>>> should bde
>>> sub AppendToLog {
>>> my $self = shift;
>>> if($self && $self->{asp}) {
>>> $self->{asp}->Log(...);
>>> }
>>> }
>>> in Response.pm. Why? My $Response variable still exists and as I
>>> don't call Log directly it seems that it shouldn't return such a hard
>>> error (die) when Apache::ASP makes that call internally.
>>
>>
>> No, $Response is no longer valid, and has been destroyed
>> during a prior request phase. It has only been cached incorrectly,
>> and this error results. Any use of $Response at this point would
>> be incorrect, so it does not make sense to spare the error with
>> a test for $Response->{asp}
>
>
> Perhaps Theo was unclear. This code block is part of Apache::ASP
> itself, not part of the userland code. We don't call this function
> directly, it's invoked internally from within Apache::ASP.
>
>>
>>>> Set these things to help catch these problems:
>>>>
>>>> PerlSetVar UseStrict 1
>>>> PerlWarn On
>>>
>>> I can do the later... But not the first. While we run both on almost
>>> all our code bases, this particular code base is a legacy one
>>> (written by another company) with over 200k lines of client .pm and
>>> .asp files. (over 100k of custom perl modules alone). So,
>>> retroactively adapting all legacy code to use strict is infeasible.
>>
>>
>> If you call Apache::ASP->Load() on all the files, you can find the
>> errors with UseStrict at compile time, so you do not get errors
>> at runtime. The process of converting over to UseStrict will catch
>> other errors besides the one that started this thread so would be
>> good for the code base to be converted to using.
>
>
> Converting 100,000 lines of mission critical code is something we don't
> have the luxury of doing. Although it is nasty, the code base works.
> The apparent bug is in Apache::ASP
>
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: $self->{asp} nor defined in Response?!
Posted by George Schlossnagle <ge...@omniti.com>.
On Tuesday, January 21, 2003, at 02:53 PM, Josh Chamas wrote:
> Theo E. Schlossnagle wrote:
>> Josh Chamas wrote:
>>> This is when an old $Response object is no longer valid. This is
>>> normally
>>> caused by my closure or bad scoping issues.
>> I assumed as much. However, it seems that:
>> sub AppendToLog { shift->{asp}->Log(...); }
>> should bde
>> sub AppendToLog {
>> my $self = shift;
>> if($self && $self->{asp}) {
>> $self->{asp}->Log(...);
>> }
>> }
>> in Response.pm. Why? My $Response variable still exists and as I
>> don't call Log directly it seems that it shouldn't return such a hard
>> error (die) when Apache::ASP makes that call internally.
>
> No, $Response is no longer valid, and has been destroyed
> during a prior request phase. It has only been cached incorrectly,
> and this error results. Any use of $Response at this point would
> be incorrect, so it does not make sense to spare the error with
> a test for $Response->{asp}
Perhaps Theo was unclear. This code block is part of Apache::ASP
itself, not part of the userland code. We don't call this function
directly, it's invoked internally from within Apache::ASP.
>
>>> Set these things to help catch these problems:
>>>
>>> PerlSetVar UseStrict 1
>>> PerlWarn On
>> I can do the later... But not the first. While we run both on almost
>> all our code bases, this particular code base is a legacy one
>> (written by another company) with over 200k lines of client .pm and
>> .asp files. (over 100k of custom perl modules alone). So,
>> retroactively adapting all legacy code to use strict is infeasible.
>
> If you call Apache::ASP->Load() on all the files, you can find the
> errors with UseStrict at compile time, so you do not get errors
> at runtime. The process of converting over to UseStrict will catch
> other errors besides the one that started this thread so would be
> good for the code base to be converted to using.
Converting 100,000 lines of mission critical code is something we don't
have the luxury of doing. Although it is nasty, the code base works.
The apparent bug is in Apache::ASP
> Regards,
>
> Josh
>
> ________________________________________________________________
> Josh Chamas, Founder phone:925-552-0128
> Chamas Enterprises Inc. http://www.chamas.com
> NodeWorks Link Checking http://www.nodeworks.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
> For additional commands, e-mail: asp-help@perl.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: $self->{asp} nor defined in Response?!
Posted by Josh Chamas <jo...@chamas.com>.
Theo E. Schlossnagle wrote:
> Josh Chamas wrote:
>
>> This is when an old $Response object is no longer valid. This is
>> normally
>> caused by my closure or bad scoping issues.
>
>
> I assumed as much. However, it seems that:
> sub AppendToLog { shift->{asp}->Log(...); }
> should bde
> sub AppendToLog {
> my $self = shift;
> if($self && $self->{asp}) {
> $self->{asp}->Log(...);
> }
> }
>
> in Response.pm. Why? My $Response variable still exists and as I don't
> call Log directly it seems that it shouldn't return such a hard error
> (die) when Apache::ASP makes that call internally.
No, $Response is no longer valid, and has been destroyed
during a prior request phase. It has only been cached incorrectly,
and this error results. Any use of $Response at this point would
be incorrect, so it does not make sense to spare the error with
a test for $Response->{asp}
>> Set these things to help catch these problems:
>>
>> PerlSetVar UseStrict 1
>> PerlWarn On
>
>
> I can do the later... But not the first. While we run both on almost
> all our code bases, this particular code base is a legacy one (written
> by another company) with over 200k lines of client .pm and .asp files.
> (over 100k of custom perl modules alone). So, retroactively adapting
> all legacy code to use strict is infeasible.
>
If you call Apache::ASP->Load() on all the files, you can find the
errors with UseStrict at compile time, so you do not get errors
at runtime. The process of converting over to UseStrict will catch
other errors besides the one that started this thread so would be
good for the code base to be converted to using.
Regards,
Josh
________________________________________________________________
Josh Chamas, Founder phone:925-552-0128
Chamas Enterprises Inc. http://www.chamas.com
NodeWorks Link Checking http://www.nodeworks.com
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: $self->{asp} nor defined in Response?!
Posted by "Theo E. Schlossnagle" <je...@omniti.com>.
Josh Chamas wrote:
> This is when an old $Response object is no longer valid. This is normally
> caused by my closure or bad scoping issues.
I assumed as much. However, it seems that:
sub AppendToLog { shift->{asp}->Log(...); }
should bde
sub AppendToLog {
my $self = shift;
if($self && $self->{asp}) {
$self->{asp}->Log(...);
}
}
in Response.pm. Why? My $Response variable still exists and as I don't call
Log directly it seems that it shouldn't return such a hard error (die) when
Apache::ASP makes that call internally.
> Set these things to help catch these problems:
>
> PerlSetVar UseStrict 1
> PerlWarn On
I can do the later... But not the first. While we run both on almost all our
code bases, this particular code base is a legacy one (written by another
company) with over 200k lines of client .pm and .asp files. (over 100k of
custom perl modules alone). So, retroactively adapting all legacy code to use
strict is infeasible.
> And also always reference ASP object like this in XMLSubs:
>
> $main::Response
>
> Alternatively, to make sure you do the former, put XMLSubs in
> a package outside of global.asa
We use no XMLSubs. There is no XML support in our Apache::ASP install at all
actually.
--
Theo Schlossnagle
Principal Consultant
OmniTI Computer Consulting, Inc. -- http://www.omniti.com/
Phone: +1 410 872 4910 x201 Fax: +1 410 872 4911
1024D/82844984/95FD 30F1 489E 4613 F22E 491A 7E88 364C 8284 4984
2047R/33131B65/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org
Re: $self->{asp} nor defined in Response?!
Posted by Josh Chamas <jo...@chamas.com>.
Theo E. Schlossnagle wrote:
> Hi, we run Apache::ASP on several largish sites...
>
> Every once in a while, I get the following error in my error logs and it
> causes either an internal server error or the page just not to load
> (depending on whether or not the offense happens in an eval {} block).
>
> We don't use $Response->Log() anywhere in our code, so it must be called
> by Apache::ASP internals. Any ideas on why this is heppening or even
> better, how to stop it?
>
> [Tue Jan 21 11:23:45 2003] [error] [asp] [1638] [error] error compiling
> flash.asp: Can't call method "Log" on an undefined value at
> /usr/lib/perl5/site_perl/5.8.0/Apache/ASP/Response.pm line 105. <-->
> Compilation failed in require at /path/to/flash.asp line 4. <--> BEGIN
> failed--compilation aborted at /path/to/flash.asp line 4. <--> ,
> /usr/lib/perl5/site_perl/5.8.0/Apache/ASP.pm line 1433
>
This is when an old $Response object is no longer valid. This is normally
caused by my closure or bad scoping issues.
Set these things to help catch these problems:
PerlSetVar UseStrict 1
PerlWarn On
And also always reference ASP object like this in XMLSubs:
$main::Response
Alternatively, to make sure you do the former, put XMLSubs in
a package outside of global.asa
Regards,
Josh
________________________________________________________________
Josh Chamas, Founder phone:925-552-0128
Chamas Enterprises Inc. http://www.chamas.com
NodeWorks Link Checking http://www.nodeworks.com
---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org