[CDBI] Re: Script that crashes mod_perl
"Edward J. Sabol" <sabol-2oVx0MVsMgiP/[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
> I have set up an apache benchmark (ab) script to get this page multiple
> times and it seems to always crash after about 2000 requests. A script
> that does the same thing with DBD::Oracle does not crash it, neither
> does one written with Ima::DBI.
Something's leaking memory, I'd guess, though I would have thought that it
would take more than 2000 requests before you'd see a problem. Things I would
try to prevent memory leaks:
1. Add "undef $auto_cv;" to the bottom of your script.
2. Put an open brace before "my ($auto_cv)" and a close brace at the end of
the script.
3. Instead of
my ($auto_cv) = dicty::CV->search( name => 'autocreated' );
use the following:
my $auto_cv = dicty::CV->search( name => 'autocreated' )->first;
4. Put each of the packages in separate .pm files and "use" them instead of
putting them all in the same file.
Just some random ideas. Not sure if they will help or not.
> I am using windows XP and Xampp and Class::DBI 3.0.6
If you're upgrading the version of CDBI you're using, why not upgrade to the
latest, v3.0.15?
> dicty::Testing->set_db('Main','dbi:Oracle:dictyBase', 'xxx', 'xxx');
set_db() is certainly out of fashion, if it isn't deprecated. I suggest using
the "connection" method, like so:
__PACKAGE__->connection($data_source, $user, $password, \%attr);
Refer to:
http://search.cpan.org/~tmtm/Class-DBI/lib/Class/DBI.pm#connection
Hope this helps,
Ed