Re: [Lxr-dev] DB only opened, never closed?
Brought to you by:
ajlittoz
From: Jens-Uwe M. <ju...@he...> - 2001-10-17 14:10:45
|
On Wed, Oct 17, 2001 at 09:58:56PM +0900, Malcolm Box wrote: > Per Kristian Gjermshus wrote: > > > > On Mon, 2001-10-15 at 11:35, Jan-Benedict Glaw wrote: > > > Every once in a while, I'm looking over the LXR code. Now, this time > > > I've realized that $index opens a DB (httpinit), but this gets > > > never closed as far as I see. I'd think that a DB connection > > > gets opened by a page request, and afterwards closed when this > > > request is finished. But there seems to be no close, is there? > > > > Right you are. There is a DESTROY method in Mysql.pm but it never gets > > called. I have made a httpclean sub that is called to clean things up it > > should be paired with httpinit. I will commit these changes shortly. > > Under mod_perl, do we want to do this? Because mod_perl keeps one > script going through several invocations, I think that we want to open > the db connection at initialisation and only close it when the apache > server thread dies. Thus the cost of the connection will be amortised > over several connections. > > It occurs to me that due to earlier changes this is not what currently > happens - there is one db connection per instance of $index, rather than > one for the module, but perhaps it is this that is wrong rather than > needing cleanup to close everything. If we use Apache::DBI additionally to DBI than it will be taken care off automatically under modperl. It will take care of managing persistent connections for us, we can safely open and close as we need for the command line/CGI environment. -- Jens-Uwe Mager HELIOS Software GmbH Steinriede 3 30827 Garbsen Germany Phone: +49 5131 709320 FAX: +49 5131 709325 Internet: ju...@he... |