[Boulder.pm] mod_perl package lexicals becoming corrupt

Rob Nagler nagler at bivio.biz
Wed Feb 13 15:36:00 PST 2008


Ran into a very nasty mod_perl bug.  Seems like package lexical
variables are getting trashed if there are "too many" of them.  When
we switch the "my" to "our" the failures went away.  There are two
distinct failure modes.

In http://www.bivio.biz/f/bOP/lib/Bivio/Biz/Model/CRMForm.pm
If I change the the $_RFC & $_CLOSED from "our" to "my", I get a
failure of this form:

    Bivio::DieCode::DIE: Can't call method "eq_new" on an undefined value at
    /Users/nagler/src/perl/Bivio/Biz/Model/CRMActionList.pm line 87.
    
What's happened is that $_CLOSE becomes undef at the same point in
execution in mod_perl.  It does not happen in the unit test, but only
when we run it under mod_perl.  We have seen this failure in an
unrelated module, which had another package lexical.  The value
becomes undef, even though it is correctly initialized.

The other failure looks like this:

    Bivio::DieCode::DIE: Undefined subroutine
    &Bivio::Biz::Model::MailForm::validate called at
    /Users/nagler/src/perl/Bivio/Biz/FormModel.pm line 908.

MailForm does not have a "validate" method:

http://www.bivio.biz/f/bOP/lib/Bivio/Biz/Model/MailForm.pm

It's in the superclass.  Again, if I change the our's at the top of
MailForm to my, the acceptance test passes (mail.btest).

We're cautiously proceeding that the problem is with the maximum
number of package lexicals.  Not conclusive, but something to watch
for. 

Rob


More information about the Boulder-pm mailing list