Apache::DBI and PerlChildExitHandler

[prev] [thread] [next] [Date index for 2004/12/21]

From: Joel
Subject: Apache::DBI and PerlChildExitHandler
Date: 14:26 on 21 Dec 2004
Good morning,

This is not a problem, per se, nor is it something I especially need to
get done, but it would certainly be nice to have and might, in some small
way, benefit the world in general. Here's what's going on:


I am using mod_perl 1.99_13 (yes, I know I should upgrade) and Apache
2.0.52. I'm using Apache::DBI/DBD::Pg to connect to a PostgreSQL server.

Everything works beautifully and the server is stable and everything like
that. But my PostgreSQL server log file has a mess of these error
messages:

    LOG:  pq_recvbuf: unexpected EOF on client connection

And from what I understand, this is caused when the Apache child exists
and does not execute an explicit $dbh->disconnect() on the database
handle. That is, the connection is not being closed properly before the
handle goes out of scope.

If this assumption is correct, I think it can be remedied by adding a
PerlChildExitHandler to simply do a $dbh->disconnect() as the child is
exiting.

In general, this is not a problem. PostgreSQL logs the 'error' and goes
about it's merry way. However, it would be nice to reduce the number of
messages in the log file, since it's all noise and gets in the way of
real errors.

Can anyone comment on the feasability of this solution? I plan to
implement it soon and if it works, provide a patch, but my brain is not
thread-enabled (I'm using prefork), so I have no knowledge of how this
would affect a threaded apache.=20

The only nagging thing about this is why hasn't anyone thought of this
and implemented it before? :) Or maybe I'm just WAY off-base.

Thanks,
--Joel

        -- 
        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

Apache::DBI and PerlChildExitHandler
Joel 14:26 on 21 Dec 2004

Re: Apache::DBI and PerlChildExitHandler
Stas Bekman 16:09 on 21 Dec 2004

Re: Apache::DBI and PerlChildExitHandler
Stas Bekman 20:26 on 22 Dec 2004

Re: Apache::DBI and PerlChildExitHandler
Perrin Harkins 16:34 on 22 Dec 2004

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