http://qs321.pair.com?node_id=143106

staunch has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I'm having a difficult time using Apache::Session::Postgres and DBI together.
I can use DBI and Apache::Session::Postgres at the same time if they open separate database connections.
But, Apache(mod_perl) segfaults if I pass the database handle to Apache::Session::Postgres.

Configuration and versions:
Apache 1.3.20
mod_perl 1.26
PostgreSQL 7.1
Apache::Session 1.54
Apache::Session::Postgres 1.01
DBI 1.201

This causes a segmentation fault:

my($dbh) = DBI->connect('dbi:Pg:dbname=dbhere', 'userhere', 'passhere' +, { AutoCommit => 1, RaiseError => 1, }) || die("DBI->connect() failed: $DBI::errstr"); tie(%session, 'Apache::Session::Postgres', undef(), { Handle => $dbh, Commit => 1, });
They work fine separately like this:
my($dbh) = DBI->connect('dbi:Pg:dbname=dbhere', 'userhere', 'passhere' +, { AutoCommit => 1, RaiseError => 1, }) || die("DBI->connect() failed: $DBI::errstr"); tie(%session, 'Apache::Session::Postgres', undef(), { DataSource => 'dbi:Pg:dbname=dbhere', UserName => 'userhere', Password => 'passhere', Commit => 1, });
Here is the second error I get, which I assume happens because of the previous segfault problem:
DBD::Pg::st execute failed: pqReadData() -- read() failed: errno=88 a +t /usr/lib/perl5/site_perl/Apache/Session/Store/DBI.pm line 65. (in cleanup) DBD::Pg::st execute failed: pqReadData() -- read() faile +d: errno=88 at /usr/lib/perl5/site_perl/Apache/Session/Store/DBI.pm l +ine 65.
I know I'm enabling autocommit multiple times, but I've tried every combination of (Auto)Commit, so I don't think that's the problem.
My random guess is that there is some variable or handle sharing problem, something isn't being released, (un)locked, committed, disconnected or whatever :)
But I really have no idea, that's why I'm asking the learned monks of Perl.

I've google'd, checked the mod_perl guide, and a few other places.
If I missed something, an RTFM with a little info about what manual to read would be welcome.
If I left any necessary information out, please let me know.


Thanks in advance,
Staunch