perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Perrin Harkins <>
Subject Re: Disconnect database connection after idle timeout
Date Thu, 13 Nov 2014 22:40:05 GMT
On Thu, Nov 13, 2014 at 5:29 PM, Vincent Veyron <> wrote:

> I stash a reference to a DBI handle in pnotes during the HeaderParser
> phase of my requests; I then refer to this handle for every request in my
> PerlResponseHandlers.
> This seems to have been working fine for several months. Am I doing
> something wrong?

No, that's perfect. Since pnotes gets cleaned up at the end of every
request, there's no danger of the handle sticking around. I assume you're
calling DBI->connect() to get the handle in the HeaderParser phase, and
using Apache::DBI?

The dangerous thing is to put a DBI handle in a global and just keep using
it on every request. If you put a DBI handle in a global (or a closure
variable) make sure you clean it up at the end of every request.

- Perrin

View raw message