Re: mod_perl and global %Live_Objects not being initialized

[prev] [thread] [next] [Date index for 2004/11/16]

From: Andy Grundman
Subject: Re: mod_perl and global %Live_Objects not being initialized
Date: 18:06 on 16 Nov 2004
William McKee wrote:
> FWIW, I've been "pretty certain" that my objects were being destroyed as
> well but then discovered accidental closures which maintained the stale
> data from the object index.

You are probably right, there must be a closure somewhere.  I realized 
that I am not actually loading Class::DBI in my startup.pl file due to 
it generating a lot of warnings, which means it wouldn't be creating any 
global variables I think.  Although, I am preloading my main Class::DBI 
subclass... Ugh, time to go scour the mod_perl docs again. :)

> Hopefully Perrin will have some insight on initializing the
> %Live_Objects. I wouldn't think that it'd be the right thing to do as
> the object index would always be wiped out and thus provide none of the
> performance benefits it was meant to give.

In the non-mod_perl world (and if my app was killing my objects 
properly), %Live_Objects only exists for a single request, right?  Any 
performance gains are only within the scope of a single request.  I 
don't see how initializing the variable would hurt anything.  I was just 
immediately drawn to this variable because the rule of never setting up 
an uninitialized my() variable like that gets beat into your brain when 
doing mod_perl. :)

> 
>>I did try these solutions, and clear_object_index ended up being the 
>>solution, when called immediately after initializing my Class::DBI 
>>object.  This is effectively the same as if Class::DBI were properly 
>>initializing the variable on its own.
> 
> 
> Have you tried placing that call at the end of your code? I can't see
> where it would make any difference the first time through. Have you
> tried running your code via Apache::PerlRun or mod_cgi (if it's an
> Apache::Registry script)? Does the problem still exist?

I didn't try moving the call, but I'd expect it would have the same 
effect.  My app is pure mod_perl, so I can't run it anywhere else.

-Andy

(message missing)

Re: mod_perl and global %Live_Objects not being initialized
Andy Grundman 18:06 on 16 Nov 2004

Re: mod_perl and global %Live_Objects not being initialized
=?ISO-8859-1?Q?Ask_Bj=F8rn_Hansen?= 03:02 on 19 Nov 2004

Generated at 17:31 on 15 Feb 2005 by mariachi v0.52