Stas Bekman wrote:
The application servers of our mod_perl site occasionally (once every
2-3 weeks) start spitting out these error messages:
[Sun Jul 3 14:58:01 2005] [error] Modification of a read-only value
attempted at
/usr/local/lib/perl5/site_perl/5.8.6/i686-linux/Apache/PerlRun.pm line
215.\n
At first only a couple Apache childs seem to be affected but after a
while the error comes on every single request, so the whole website
comes to a stall.
Can you reproduce the problem at will?
Unfortunately not. Although I have seen the problem on our development
system (where I was testing), the problem is not reproducable. As I said
the live system doesn't behave deterministically either. The conditions
under which is fails are always similar, but it doesn't fail always
under these conditions.
The problem only accurs if the central mainframe we are working
against is having a problem and we are doing a lot of error handling.
However, the problem does not alway occur if there is a problem with
the mainframe and all processing that actually does get started
finishes totally fine.
The relevant line in PerlRun.pm is
sub readscript {
my $pr = shift;
$pr->{'code'} = $pr->{r}->slurp_filename; # this is line 215
}
My understanding of the "Modfication of read-only..." error is that it
cant really occur on that line, since there are no literals being
modified.
Any help or pointer in the right direction would be really
appreciated. If the solution is to move away from Apache::PerlRun to
something else that would be alright, too. We'd like to avoid it
though, because we are satisfied with the speed and don't want to
repeat the whole testing phase.
Quite often the error line is reported incorrectly. You can always add
something like:
#line 215
$pr->{'code'} = $pr->{r}->slurp_filename;
I'll try that, but I haven't been able to reproduce the problem yet. Can
I be sure that the reported file is right?
Once you figure out the exact line, you need to figure out where the
error is coming from? You could use Devel::Peek to see what variable is
readonly. e.g.:
use Devel::Peek;
my $x = 5;
Dump $x;
For example $$ is readonly, so you get:
That is a good hint. I only had literals on my mind and I didn't think
of special vars.
Our code is not using any specials variables though except %SIG for alarm.
If the error occurs, it seem to bubble from apache child to apache child
like an infection (Although it seems to take a pretty long time (like 15
Minutes)). That's why I always figured that this bug must be releated to
source code that is being modified and copied to the children.
Thanks for your help,
Malte Ubl
--
SCHAFFHAUSEN COMMUNICATION GROUP
Schaffhausen Advertising GmbH / Daimlerstraße 17 / 25337 Elmshorn
Fon +49 41 21.47 29-459 / Fax +49 41 21.47 29-455
[EMAIL PROTECTED] / www.schaffhausen.de