Re: [Lxr-dev] DB only opened, never closed?
Brought to you by:
ajlittoz
From: Jan-Benedict G. <jb...@lu...> - 2001-10-17 13:46:06
|
On Wed, 2001-10-17 21:58:56 +0900, Malcolm Box <ma...@br...> wrote in message <3BC...@br...>: > 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 As long as everything goes well, we don't. But you know I see these mysterious things here:-) I've upgraded recently to one of those famous Dual Athlons and kept stress-testing CVS, PostgreSQL and LXR to quite some amount. - PostgreSQL is fine and fast - Apache seems to be fine also - CVS... Well, CVS itself is fine, but "co" (from RCS) can easily be found in zombi state (which means that ((LXR|mod_perl)|apache) didn't clean up the SIGCHLD. - Lang/Generic.pm not found problems with and without this `use lib do { $0 =~ m{(.*)/} ? "$1/lib" : "lib" };' line. At least I don't know your setups. Mine seems quite normal to me, except this mapping-to-nothing antry in the maps array (hash?): 'maps' => { '/include/asm-noarch/' => '/include/asm/', '/include/asm[^\/]*/' => '/include/asm-$a/', '/arch/[^\/]+/' => '/arch/$a/', }, Btw., I'm experiencing some formatting failures, but I don't care much about them currently. These show up like this: 1.1 jbglaw 001 code 002 more code 003 even more code 004 code is no longer shifted right by some whitespaces:-/ 005 code keeps on sitting the left side:-[ This does also happen in "diff" view. When the left file is at it's end and the "right" one gets printed on the very left side... Well, some last words wrt opened DB connections. It's fine to keep them opened. But LXR should not be within a transaction. Here an excerpt from "ps axf": 238 ? S 0:00 /usr/lib/postgresql/bin/postmaster -D /var/lib/postgres/data 27114 ? S 0:00 \_ postgres: www-data lxr [local] idle in transaction 27117 ? S 0:00 \_ postgres: www-data lxr [local] idle in transaction 27119 ? S 0:00 \_ postgres: www-data lxr [local] idle in transaction 27132 ? S 0:00 \_ postgres: www-data lxr [local] idle in transaction 27200 ? S 0:00 \_ postgres: www-data lxr [local] idle in transaction 27323 ? S 0:00 \_ postgres: www-data lxr [local] idle in transaction 27350 ? S 0:00 \_ postgres: www-data lxr [local] idle in transaction 27567 ? S 0:00 \_ postgres: www-data lxr [local] idle 552 ? S 0:00 \_ /usr/sbin/sshd 553 pts/0 S 0:00 | \_ -bash 579 pts/0 S 0:00 | \_ -su 27560 pts/0 S 0:00 | \_ /usr/lib/postgresql/bin/psql -U www-data -d lxr 305 ? S 0:03 /usr/sbin/apache 324 ? S 0:04 \_ /usr/sbin/apache 325 ? S 0:00 \_ /usr/sbin/apache 326 ? S 0:02 \_ /usr/sbin/apache 327 ? S 0:00 \_ /usr/sbin/apache 27427 ? Z 0:00 | \_ [co <defunct>] 328 ? S 0:00 \_ /usr/sbin/apache 27285 ? Z 0:00 | \_ [co <defunct>] 27113 ? S 0:00 \_ /usr/sbin/apache 27284 ? S 0:00 \_ /usr/sbin/apache 27503 ? Z 0:00 \_ [co <defunct>] So there you see that ther seems to be something going on with the database... I'll try to get some time to search for BEGIN und COMMIT parts of SQL, but I fear they're hidden behind Perl's DBI/DBD... I'm willing to spend time, but I'll need assistance:-( I feel there's no easy way of debugging under apache/mod_perl (like gdb for C), so it would be *very* fine if anybody could give me (or place temporary into LXR's lib) something like a DebugPrintF, outputting (always to say /tmp/LXR.log) current PID, line number and given text message. I'm blameable a total NULLo in Perl (I've tried several times to learn a bit, but I don't understand it. I'm hacking C for (since?) years no with no problems, but I fail understanding Perl...). I'd really make use of such a function (as kind of a break point:-) Would it be possible to include such a function to CVS? MfG, JBG -- Jan-Benedict Glaw . jb...@lu... . +49-172-7608481 |