BerkelyDB problem - seg fault 11

[prev] [thread] [next] [Date index for 2005/04/15]

From: Rick Jansen
Subject: BerkelyDB problem - seg fault 11
Date: 09:09 on 15 Apr 2005
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 child gets killed on the second run,
if I close the environment 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, it runs fine,
but this has other implications for name space collisions.

What obvious thing am I missing? Thanks for ideas!

(Apache 1.33, Perl 5.8.6, mod_perl 1.29, BerkeleyDB 4.2.52, Perl
interface 0.25)

        -- 
        Rick

BerkelyDB problem - seg fault 11
Rick Jansen 09:09 on 15 Apr 2005

Re: BerkelyDB problem - seg fault 11
Perrin Harkins 15:19 on 15 Apr 2005

Re: BerkelyDB problem - seg fault 11
Rick Jansen 21:46 on 15 Apr 2005

Re: BerkelyDB problem - seg fault 11
Perrin Harkins 22:06 on 15 Apr 2005

Generated at 12:49 on 16 Apr 2005 by mariachi v0.52