$DBI::errstr == (no error string)

$DBI::errstr == (no error string)

am 23.12.2005 20:19:30 von aturner

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm going quickly insane trying to debug this...

Long story short:
DBI 1.50
DBD::Pg 1.43
Perl 5.8.5
mod_perl 2.0.2
Class::DBI 3.0.1
Apache::DBI 0.9901

Basic problem is that I can't connect to my PG database from inside
Apache from my Linux box (running Apache 2.0.52/prefork) but I can
from my OS X box (Apache 2.2.0/prefork). Using the same DBI
abstraction layer and options (user, password, etc), I can connect
from standalone perl scripts on both boxes just fine. The relevant
parts of the trace from the failed connection attempt is:

DBI connect('database=******;host=******;port=5432','muuser',... )
failed: (no error string) at /var/www/html/mulder/lib/Mu/DBI.pm line 63


Trace begun at /usr/lib/perl5/site_perl/5.8.5/HTML/Mason/
Exceptions.pm line 129
HTML::Mason::Exceptions::rethrow_exception('DBI connect
(\'database=*****;host=******;port=5432\',\'muuser\',...) failed: (no
error string) at /var/www/html/mulder/lib/Mu/DBI.pm line 63^J')
called at /usr/lib/perl5/5.8.5/Carp.pm line 201
Carp::croak('DBI connect(\'database=*****;host=******;port=5432\',
\'muuser\',...) failed: (no error string)') called at /usr/lib/perl5/
site_perl/5.8.5/i386-linux-thread-multi/DBI.pm line 629
DBI::__ANON__(undef, undef) called at /usr/lib/perl5/site_perl/5.8.5/
i386-linux-thread-multi/DBI.pm line 681
DBI::connect('DBI', 'dbi:Pg:database=*****;host=******;port=5432',
'muuser', '*****', 'HASH(0x97c4398)') called at /var/www/html/mulder/
lib/Mu/DBI.pm line 63
Mu::DBI::connect('Mu::DBI', 'singlepid', 1) called at /var/www/html/
mulder/www/syshandler line 8


Looking at pcap's and my PG log files (debug level 5) it seems that I
connect and authenticate just fine, but then the connection just
shuts down.

Other then upgrading my Apache to 2.2.0 (which seems a bit overkill
and a PITA due to all the extra modules I'm using) how can I debug
this to figure out why DBI is barfing?

The actual connect statement is:
my %dbh;

$dbh{'singlepid'} = DBI->connect(Mu::DBI->dsn, Mu::Config->DBUSER,
Mu::Config->DBPASS, { PrintError => 1, RaiseError => 1,
AutoCommit => 0,
FetchHashKeyName => 'NAME_lc', ShowErrorStatement => 1,
ChopBlanks => 1, Taint => 1, RootClass =>
'DBIx::ConextualFetch'}) or
croak("Can't connect to DB: $DBI::errstr");

Thanks,
Aaron


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)

iD8DBQFDrE3DklVhPAXg8nARAjUKAJ9ZhUFr/gEHeGD0lEDE6UvSYbLsegCf YLg5
HC2zIxXRo36Kfg3C1EswMMY=
=NqpO
-----END PGP SIGNATURE-----

Re: $DBI::errstr == (no error string)

am 24.12.2005 17:58:52 von Tim.Bunce

On Fri, Dec 23, 2005 at 11:19:30AM -0800, Aaron Turner wrote:
>
> DBI connect('database=******;host=******;port=5432','muuser',... )
> failed: (no error string) at /var/www/html/mulder/lib/Mu/DBI.pm line 63

> Other then upgrading my Apache to 2.2.0 (which seems a bit overkill
> and a PITA due to all the extra modules I'm using) how can I debug
> this to figure out why DBI is barfing?

Try using a higher level of DBI trace, such as DBI->trace(15), before
the connect call.

Tim.

Re: $DBI::errstr == (no error string)

am 24.12.2005 19:00:50 von aturner

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Here's what I got... not sure what it all means, but I don't see
anything which jumps out as borked:

DBI 1.50-ithread default trace level set to 0x0/15 (pid 9839)
-> DBI->connect(dbi:Pg:database=******;host=******;port=5432,
muuser, ****, HASH(0xa20b210))
-> DBI->install_driver(Pg) for linux perl=5.008005 pid=9839
ruid=48 euid=48
install_driver: DBD::Pg version 1.43 loaded from /usr/lib/
perl5/site_perl/5.8.5/i386-linux-thread-multi/DBD/Pg.pm
New DBI::dr (for DBD::Pg::dr, parent=, id=)
dbih_setup_handle(DBI::dr=HASH(0x9c012d4)=>DBI::dr=HASH
(0xa66df00), DBD::Pg::dr, 0, Null!)
dbih_make_com(Null!, 0, DBD::Pg::dr, 84, 0) thr#9a3e020
dbih_setup_attrib(DBI::dr=HASH(0xa66df00), Err, Null!) SCALAR
(0x9f90808) (already defined)
dbih_setup_attrib(DBI::dr=HASH(0xa66df00), State, Null!) SCALAR
(0x9f90838) (already defined)
dbih_setup_attrib(DBI::dr=HASH(0xa66df00), Errstr, Null!) SCALAR
(0x9f90820) (already defined)
dbih_setup_attrib(DBI::dr=HASH(0xa66df00), TraceLevel, Null!) 0
(already defined)
dbih_setup_attrib(DBI::dr=HASH(0xa66df00), FetchHashKeyName,
Null!) 'NAME' (already defined)
install_method DBI::db::pg_putline
install_method DBI::db::pg_getline
install_method DBI::db::pg_endcopy
install_method DBI::db::pg_server_trace
install_method DBI::db::pg_server_untrace
install_method DBI::db::pg_savepoint
install_method DBI::db::pg_rollback_to
install_method DBI::db::pg_release
<- install_driver= DBI::dr=HASH(0x9c012d4)
>> connect DISPATCH (DBI::dr=HASH(0x9c012d4) rc2/3 @5 g0
ima1 pid#9839) at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-
multi/DBI.pm line 617 via /var/www/html/mulder/www/syshandler line 8
!! warn: 0 CLEARED by call to connect method
-> connect for DBD::Pg::dr (DBI::dr=HASH(0x9c012d4)~0xa66df00
'database=*****;host=*******;port=5432' 'muuser' **** HASH
(0xa6889b4)) thr#9a3e020
New DBI::db (for DBD::Pg::db, parent=DBI::dr=HASH(0xa66df00), id=)
dbih_setup_handle(DBI::db=HASH(0xa66dedc)=>DBI::db=HASH
(0xa688a44), DBD::Pg::db, 9bfdfdc, Null!)
dbih_make_com(DBI::dr=HASH(0xa66df00), a66f8f8, DBD::Pg::db,
124, 0) thr#9a3e020
dbih_setup_attrib(DBI::db=HASH(0xa688a44), Err, DBI::dr=HASH
(0xa66df00)) SCALAR(0x9c04b68) (already defined)
dbih_setup_attrib(DBI::db=HASH(0xa688a44), State, DBI::dr=HASH
(0xa66df00)) SCALAR(0x9c04bc8) (already defined)
dbih_setup_attrib(DBI::db=HASH(0xa688a44), Errstr, DBI::dr=HASH
(0xa66df00)) SCALAR(0x9c04b98) (already defined)
dbih_setup_attrib(DBI::db=HASH(0xa688a44), TraceLevel,
DBI::dr=HASH(0xa66df00)) 0 (already defined)
dbih_setup_attrib(DBI::db=HASH(0xa688a44), FetchHashKeyName,
DBI::dr=HASH(0xa66df00)) 'NAME' (already defined)
dbih_setup_attrib(DBI::db=HASH(0xa688a44), HandleSetErr,
DBI::dr=HASH(0xa66df00)) undef (not defined)
dbih_setup_attrib(DBI::db=HASH(0xa688a44), HandleError, DBI::dr=HASH
(0xa66df00)) undef (not defined)
dbd_db_login
dbdpg: login connection string: (dbname=****** host=******
port=5432 user='muuser' password='****')
>> DESTROY DISPATCH (DBI::db=HASH(0xa66dedc) rc1/1 @1 g0
ima4 pid#9839) at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-
multi/DBI.pm line 617 via /var/www/html/mulder/lib/Mu/DBI.pm line 65
<> DESTROY(DBI::db=HASH(0xa66dedc)) ignored for outer handle
(inner DBI::db=HASH(0xa688a44) has ref cnt 1)
>> DESTROY DISPATCH (DBI::db=HASH(0xa688a44) rc1/1 @1 g0
ima4 pid#9839) at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-
multi/DBI.pm line 617 via /var/www/html/mulder/lib/Mu/DBI.pm line 65
-> DESTROY for DBD::Pg::db (DBI::db=HASH(0xa688a44)~INNER)
thr#9a3e020
rollback
dbd_db_disconnect
rollback
dbd_db_disconnect: AutoCommit=off -> rollback
dbd_db_destroy
<- DESTROY= undef at /usr/lib/perl5/site_perl/5.8.5/i386-linux-
thread-multi/DBI.pm line 617 via /var/www/html/mulder/lib/Mu/DBI.pm
line 65
DESTROY (dbih_clearcom) (dbh 0xa688a44, com 0xa689e90, imp
DBD::Pg::db):
FLAGS 0x100011: COMSET Warn PrintWarn
PARENT DBI::dr=HASH(0xa66df00)
KIDS 0 (0 Active)
IMP_DATA undef
dbih_clearcom 0xa688a44 (com 0xa689e90, type 2) done.

<- connect= undef at /usr/lib/perl5/site_perl/5.8.5/i386-linux-
thread-multi/DBI.pm line 617 via /var/www/html/mulder/www/syshandler
line 8
-> $DBI::errstr (&) FETCH from lasth=HASH
>> DBD::Pg::dr::errstr
<- $DBI::errstr= undef
DBI connect
('database=****;host=*****;port=5432','muuser',...) failed: (no error
string)


Any ideas? Thanks,
Aaron

On Dec 24, 2005, at 8:58 AM, Tim Bunce wrote:

> On Fri, Dec 23, 2005 at 11:19:30AM -0800, Aaron Turner wrote:
>>
>> DBI connect('database=******;host=******;port=5432','muuser',... )
>> failed: (no error string) at /var/www/html/mulder/lib/Mu/DBI.pm
>> line 63
>
>> Other then upgrading my Apache to 2.2.0 (which seems a bit overkill
>> and a PITA due to all the extra modules I'm using) how can I debug
>> this to figure out why DBI is barfing?
>
> Try using a higher level of DBI trace, such as DBI->trace(15), before
> the connect call.
>
> Tim.
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)

iD8DBQFDrYzjklVhPAXg8nARAqdqAJ97H4+Q/XdWFOXnDoiWFG2jWqKBOwCf SM6X
wq138VPHOfbj2jwMDBqRykU=
=Ii9L
-----END PGP SIGNATURE-----

Re: $DBI::errstr == (no error string)

am 27.12.2005 17:50:07 von Tim.Bunce

On Sat, Dec 24, 2005 at 10:00:50AM -0800, Aaron Turner wrote:
> Hash: SHA1
>
> Here's what I got... not sure what it all means, but I don't see
> anything which jumps out as borked:
>
> -> connect for DBD::Pg::dr (DBI::dr=HASH(0x9c012d4)~0xa66df00
> 'database=*****;host=*******;port=5432' 'muuser' **** HASH
> (0xa6889b4)) thr#9a3e020
> New DBI::db (for DBD::Pg::db, parent=DBI::dr=HASH(0xa66df00), id=)
> dbih_setup_handle(DBI::db=HASH(0xa66dedc)=>DBI::db=HASH
> (0xa688a44), DBD::Pg::db, 9bfdfdc, Null!)
> dbd_db_login
> dbdpg: login connection string: (dbname=****** host=******
> port=5432 user='muuser' password='****')

Trying to connect here.

> >> DESTROY DISPATCH (DBI::db=HASH(0xa66dedc) rc1/1 @1 g0
> ima4 pid#9839) at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-
> multi/DBI.pm line 617 via /var/www/html/mulder/lib/Mu/DBI.pm line 65
> <> DESTROY(DBI::db=HASH(0xa66dedc)) ignored for outer handle
> (inner DBI::db=HASH(0xa688a44) has ref cnt 1)
> >> DESTROY DISPATCH (DBI::db=HASH(0xa688a44) rc1/1 @1 g0
> ima4 pid#9839) at /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-
> multi/DBI.pm line 617 via /var/www/html/mulder/lib/Mu/DBI.pm line 65
> -> DESTROY for DBD::Pg::db (DBI::db=HASH(0xa688a44)~INNER)
> thr#9a3e020
> rollback
> dbd_db_disconnect
> rollback
> dbd_db_disconnect: AutoCommit=off -> rollback
> dbd_db_destroy
> <- DESTROY= undef at /usr/lib/perl5/site_perl/5.8.5/i386-linux-
> thread-multi/DBI.pm line 617 via /var/www/html/mulder/lib/Mu/DBI.pm
> line 65
> DESTROY (dbih_clearcom) (dbh 0xa688a44, com 0xa689e90, imp
> DBD::Pg::db):
> FLAGS 0x100011: COMSET Warn PrintWarn
> PARENT DBI::dr=HASH(0xa66df00)
> KIDS 0 (0 Active)
> IMP_DATA undef
> dbih_clearcom 0xa688a44 (com 0xa689e90, type 2) done.

The above relates to the database handle being destroyed.

> <- connect= undef at /usr/lib/perl5/site_perl/5.8.5/i386-linux-
> thread-multi/DBI.pm line 617 via /var/www/html/mulder/www/syshandler line 8

That's the connect returning.

> -> $DBI::errstr (&) FETCH from lasth=HASH
> >> DBD::Pg::dr::errstr
> <- $DBI::errstr= undef
> DBI connect
> ('database=****;host=*****;port=5432','muuser',...) failed: (no error
> string)
>
> Any ideas? Thanks,

Whatever the underlying issue is, there's clearly a bug in DBD::Pg in
that there's some path through the code that doesn't record an error
when it should.

Tim.