Rick Jansen *nix forums beginner
Joined: 21 Jul 2005
Posts: 2
|
Posted: Tue Apr 12, 2005 7:52 pm Post subject:
mod_perl problem - seg fault 11
|
|
|
I'm converting an existing CGI-script that uses Berkely DB with CDB to a
mod_perl version, and I'm running into a problem. The first run works
fine, but the second hit causes a "child pid ... exit signal
Segmentation fault (11)" in the following line, UNLESS I close the
environment after each run, and re-open it for the next run. Alas, this
causes overhead that I'd rather get rid of:
sub Something {
# crashes:
my $DB_Object = new BerkeleyDB::Hash
-Filename => $DB,
-Env => $Env,
-Flags => DB_RDONLY ...
}
To avoid name collisions the application is split in a main program
calling a run-routine from a separate module, as follows:
use strict;
use Appl::ApplMain;
Appl::ApplMain::run();
This is the separate module Appl/ApplMain.pm:
package Appl::ApplMain;
my $Env = new BerkeleyDB::Env ....
sub run {
<open env if not open>
<processing>
<*close env*>
}
1;
If I leave out the <close env> the app gets killed on the second run, if
I close the environments it runs fine.
Interestingly, if I don't put the run-subroutine in a separate module,
but in a *library* that is require-d in the main program, no crash
happens, but this has other implications for name space collisions.
What am I missing? Thanks!
--
Rick Jansen |
|