X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3E9CFD1B432 for ; Mon, 15 Dec 2003 20:10:23 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 03886-06 for ; Mon, 15 Dec 2003 16:10:02 -0400 (AST) Received: from upsn242.cri.u-psud.fr (upsn242.cri.u-psud.fr [129.175.34.242]) by svr1.postgresql.org (Postfix) with ESMTP id DF3A8D1B476 for ; Mon, 15 Dec 2003 16:09:54 -0400 (AST) Received: from upsn231.cri.u-psud.fr (upsn231.cri.u-psud.fr [129.175.34.231]) by upsn242.cri.u-psud.fr (8.12.10/8.12.0.Beta10) with ESMTP id hBFK9c7m021536 for ; Mon, 15 Dec 2003 21:09:38 +0100 Received: from poppu.fleming.u-psud.fr (poppu.fleming.u-psud.fr [172.17.64.4]) by upsn231.cri.u-psud.fr (8.12.10/8.12.0.Beta10) with ESMTP id hBFK9fhm008607 for ; Mon, 15 Dec 2003 21:09:42 +0100 Received: from jfk (jfk.fleming.u-psud.fr [172.17.64.148]) by poppu.fleming.u-psud.fr (Postfix) with SMTP id 32AE220F0 for ; Mon, 15 Dec 2003 21:11:59 +0100 (CET) From: "Sylvain Ross" To: Subject: What is wrong with pg_pconnect() ? Date: Mon, 15 Dec 2003 21:09:56 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Scanned: by amavis X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/35 X-Sequence-Number: 2481 Hi, I read a few sites (including php.net, article about db persistent connections) speaking about the adventage of pg_pconnect() php function... I got a "big" problem with pconnections made with the pg_pconnect function. The problem is the following : I'm using a stable debian with: apache 1.3.26 php 4.1.2 postgres 7.2 (I know some guys thinks those are old versions... no, it's just debian stable versions ;)) So , here is the pb : - A client connects for the first time to my httpd and load a script which contain a pg_pconnect() call, what create a pgsql process... so far so good ... - As my httpd is in keepalive mode (wiuth a keepalive_timeout of 15 secs), if the user loads another page with an other pg_pconnect() call (with the same parameters as the first pconnect()), it uses the same pgsql process created before. Cool ! pconnect is great ! - BUT, when the keepalive times out, the dedicated apache process dies (what is normal), BUT the pgsql thread is still alive ! with "idle" state ! Of course, since the related apache process has died, this idling pgsql process will stay in memory for ever ! won't be reused ever ! I don't know how to deal with this ! If the pgsql forked-process where killed when apache forked-process die, all should be OK ! but it does not :( Tell me if there are any solutions... Thanks in advance. Sylvain