Perrin

I have an InitHandler in a Files section (in order to promote perl i put this
extension to the files).

<Files *.perl>
     PerlInitHandler General::init_dbk
     SetHandler  perl-script
     PerlHandler Fosis
</Files>

Fosis::handler is the main Dispatcher of the dynamic content. It can use the
database handler via a Global variable $dbh, initialized en the init_db
process showed above, this database variable is defined in the General module
and is exported by default into the namespace in every module that uses the
module.

sub init_db {
                                                                             
                                               
$dbh = DBI->connect($dsn, $user, $pass, $options) or die "Imposible conectar
con la base de datos. " .  DBI->errstr;                                      
                                                                             
        
                                                                             
                                               
}

There is no more about the database connection in any side of the System.

I turned on $Apache::DBI on level 2 of debugging and i've included the output
of the error_log. It doesn't look so bad... at first glance it looks like some
connections are being reused. And the message: "Issuing rollback() for
database handle ..." isn't generated in all the requests.

# 1: report about new connect
# 2: full debug output
$Apache::DBI::DEBUG = 2;

Begin of output
--------------------------------------------------------------------------
17985 Apache::DBI             push PerlCleanupHandler
17985 Apache::DBI             need ping: yes
17985 Apache::DBI             already connected to
'dbname=puente;host=localhost^\userid^\xxxxx^\AutoCommit=0^\PrintError=1^\RaiseError=1^\Username=userid'
17985 Apache::DBI             PerlCleanupHandler
17985 Apache::DBI             PerlCleanupHandler rollback for
dbname=puente;host=localhost^\userid^\xxxxx^\AutoCommit=0^\PrintError=1^\RaiseError=1^\Username=userid
18067 Apache::DBI             PerlCleanupHandler
18067 Apache::DBI             PerlCleanupHandler rollback for
dbname=puente;host=localhost^\userid^\xxxxx^\AutoCommit=0^\PrintError=1^\RaiseError=1^\Username=userid
17987 Apache::DBI             push PerlCleanupHandler
17987 Apache::DBI             need ping: yes
17987 Apache::DBI             already connected to
'dbname=puente;host=localhost^\userid^\xxxxx^\AutoCommit=0^\PrintError=1^\RaiseError=1^\Username=userid'
17987 Apache::DBI             need ping: no
17987 Apache::DBI             already connected to
'dbname=puente;host=localhost^\userid^\xxxxx^\AutoCommit=0^\PrintError=1^\RaiseError=1^\Username=userid'
17987 Apache::DBI             PerlCleanupHandler
17987 Apache::DBI             PerlCleanupHandler rollback for
dbname=puente;host=localhost^\userid^\xxxxx^\AutoCommit=0^\PrintError=1^\RaiseError=1^\Username=userid
18071 Apache::DBI             push PerlCleanupHandler
18071 Apache::DBI             need ping: yes
18071 Apache::DBI             new connect to
'dbname=puente;host=localhost^\userid^\xxxxx^\AutoCommit=0^\PrintError=1^\RaiseError=1^\Username=userid'
Issuing rollback() for database handle being DESTROY'd without explicit
disconnect().
18071 Apache::DBI             PerlCleanupHandler
18071 Apache::DBI             PerlCleanupHandler rollback for
dbname=puente;host=localhost^\userid^\xxxxx^\AutoCommit=0^\PrintError=1^\RaiseError=1^\Username=userid
18066 Apache::DBI             push PerlCleanupHandler
18066 Apache::DBI             need ping: yes
18066 Apache::DBI             already connected to
'dbname=puente;host=localhost^\userid^\xxxxx^\AutoCommit=0^\PrintError=1^\RaiseError=1^\Username=userid'
18066 Apache::DBI             PerlCleanupHandler
18066 Apache::DBI             PerlCleanupHandler rollback for
dbname=puente;host=localhost^\userid^\xxxxx^\AutoCommit=0^\PrintError=1^\RaiseError=1^\Username=userid
18048 Apache::DBI             push PerlCleanupHandler
18048 Apache::DBI             need ping: yes
18048 Apache::DBI             already connected to
'dbname=puente;host=localhost^\userid^\xxxxx^\AutoCommit=0^\PrintError=1^\RaiseError=1^\Username=userid'
18048 Apache::DBI             PerlCleanupHandler
18048 Apache::DBI             PerlCleanupHandler rollback for
dbname=puente;host=localhost^\userid^\xxxxx^\AutoCommit=0^\PrintError=1^\RaiseError=1^\Username=userid
17988 Apache::DBI             PerlCleanupHandler
17988 Apache::DBI             PerlCleanupHandler rollback for
dbname=puente;host=localhost^\userid^\xxxxx^\AutoCommit=0^\PrintError=1^\RaiseError=1^\Username=userid
17984 Apache::DBI             push PerlCleanupHandler
17984 Apache::DBI             need ping: yes
17984 Apache::DBI             already connected to
'dbname=puente;host=localhost^\userid^\xxxxx^\AutoCommit=0^\PrintError=1^\RaiseError=1^\Username=userid'
17984 Apache::DBI             PerlCleanupHandler
17984 Apache::DBI             PerlCleanupHandler rollback for
dbname=puente;host=localhost^\userid^\xxxxx^\AutoCommit=0^\PrintError=1^\RaiseError=1^\Username=userid
--------------------------------------------------------------------------
End of output

Thank you
Hans

On Thu, 06 May 2004 12:41:06 -0400, Perrin Harkins wrote
> On Thu, 2004-05-06 at 12:42, Hans Poo R. wrote:
> > I removed the manual rollback and let the job to Apache::DBI, the problem is
> > that after the change, the message about the handle destroyed still appears in
> > the log. I activated the $Apache::DBI::DEBUG variable, but the message persist
> > (now with the DEBUG information).
> 
> Does the debug info show that Apache::DBI is holding onto the connection
> or making a new connection every time?  The error you're getting is one
> that DBI gives when a database handle goes out of scope (or gets
> explicitly undef'ed) without being disconnected.  A handle that
> Apache::DBI is keeping persistent should not get DESTROY'd when it goes
> out of scope.
> 
> You might want to run this in the debugger and see where this is
> happening.
> 
> > It looks like it's a postgreSQL specific problem.
> 
> I don't see anything PostgreSQL-specific in the errors you showed us.
> 
> - Perrin


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to