Stas Bekman wrote:
Malte Ubl wrote:
[...]

Our code is not using any specials variables though except %SIG for alarm.


I've used $$ just as an example, any variable can be affected.


How does a variable become read-only? Is that something that can be done on C/XS Level?


Yes. By setting the READONLY flag on the scalar. But it may happen as a result of some bug.

You also get a readonly variable if it's not a variable but a constant, e.g.:

perl -MDevel::Peek -le 'Dump "aaa"'
SV = PV(0x804c4a0) at 0x805b88c
  REFCNT = 1
  FLAGS = (POK,READONLY,pPOK)
  PV = 0x805e420 "aaa"\0
  CUR = 3
  LEN = 4

so for example if a function receives a string as an argument, e.g., foo("aaa") and then the function tries to modify its $_[0]'s argument you will get this error.

We made this test on the production system where the error seems to occur on about 50% of the occassions described in my older mails.

We introduced a #line statement which gives conclusive results pointing to this line in PerlRun.pm:
$pr->{'code'} = $pr->{r}->slurp_filename; # this is line 215

Then we pumped $pr using Devel::Peek. The result is:
<dump>
SV = RV(0x87893e4) at 0x8461c04
  REFCNT = 1
  FLAGS = (PADBUSY,PADMY,ROK)
  RV = 0x8f7082c
  SV = PVHV(0x90e0b18) at 0x8f7082c
    REFCNT = 2
    FLAGS = (OBJECT,SHAREKEYS)
    IV = 3
    NV = 0
    STASH = 0x83aebe4   "Apache::PerlRun"
    ARRAY = 0x9165db0  (0:6, 1:1, 2:1)
    hash quality = 90.0%
    KEYS = 3
    FILL = 2
    MAX = 7
    RITER = -1
    EITER = 0x0
    Elt "namespace" HASH = 0xb25e00b2
    SV = PV(0x915e728) at 0x8fcedd4
      REFCNT = 1
      FLAGS = (POK,pPOK)
      PV = 0x9197b00 "Apache::ROOTappsrv2::bin::rpc_2dxml_2emplr"\0
      CUR = 42
      LEN = 43
    Elt "r" HASH = 0x26014be2
    SV = RV(0x8789250) at 0x8f6dce8
      REFCNT = 1
      FLAGS = (ROK)
      RV = 0x8fa6a98
      SV = PVMG(0x9156468) at 0x8fa6a98
        REFCNT = 3
        FLAGS = (OBJECT,IOK,pIOK)
        IV = 137085032
        NV = 0
        PV = 0
        STASH = 0x82eb0b4       "Apache"
    Elt "mtime" HASH = 0x1c616a53
    SV = NV(0x904ba10) at 0x8fcef9c
      REFCNT = 1
      FLAGS = (NOK,pNOK)
      NV = 108.194803240741
</dump>

There doesn't seem to be anything read-only here?

One extra piece of information: The app that we ported to mod_perl uses file-locks (flock) using type glob (pre perl 5.6 style) file handles.

Could this error occur if the close or unlock a type glob that does not have a file handle in it?

Thanks

Malte

--
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

Reply via email to