Skip site navigation (1) Skip section navigation (2)

What is wrong with pg_pconnect() ?

From: "Sylvain Ross" <jfk(at)fleming(dot)u-psud(dot)fr>
To: <pgsql-php(at)postgresql(dot)org>
Subject: What is wrong with pg_pconnect() ?
Date: 2003-12-15 20:09:56
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-php

I read a few sites (including, 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.



pgsql-php by date

Next:From: Thom DysonDate: 2003-12-15 20:23:07
Subject: Re: A progress page with PHP + PostgreSQL
Previous:From: Sai Hertz And Control SystemsDate: 2003-12-15 19:30:06
Subject: A progress page with PHP + PostgreSQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group