From: Daniel Walters <daniel.walters@hitwise.com>
To: pgsql-php@postgresql.org
Subject: Re: Trouble with conections between php and postgre
Date: Tue, 4 Oct 2005 08:26:43 +1000
Message-ID: <20051003222537.D15FA16E152@kyle.sinewave.com.au> (raw)
In-Reply-To: <226b0df80510030659m39c4f7fdn@mail.gmail.com>
The lock is caused by PHP the page running the queries locking the user's
SESSION file. The php script execution suspends when running each query so
the lock remains. Subsequent page requests will all pause at
session_start(); while waiting for the lock to be removed.
A session_write_close(); (call it before any db_query is run) can be of
assistance because it writes out the session file and thus no lock will be
kept. The problem is that this will send a cookie header to the client.
Multiple calls send further cookie headers :( IE will die with an unhelpful
error page if it receives around 25 of these headers...
What they really need to implement is a session_pause() and
session_restart(). This has been suggested before and there was even
documentation for these functions but it never made it into a PHP as far I
was aware and the documentation has since been removed from more recent PHP
documentation.
A more permanent way around this might be to use a database to hold the
sessions so you are not subject to the file-locking limitations.
Alternatively you could overide the file based session handling with your
own implementation and choose to discard session data from pages if a more
recent page has tried to access the session.
Regards,
Daniel Walters
-----Original Message-----
From: pgsql-php-owner@postgresql.org [mailto:pgsql-php-owner@postgresql.org]
On Behalf Of luis linietsky
Sent: Tuesday, October 04, 2005 12:00 AM
To: pgsql-php@postgresql.org
Subject: [PHP] Trouble with conections between php and postgre
Hi !, first of all: sorry about my english, i'm not from us.
I 'm using latest versions of postgre 7.4 with php4 and apache2, on a debian
system. I'm working with a really big database, so there are many querys
that takes too much time to be executed (And there's nothig to do about it).
These querys blocks the php page while's being loaded. The problem is that
usually, one excepcts to stop those querys or even close the conection if
the user stops the explorer or closes the window. However, this isn't
hapening, the query keeps running in the database, using resources.
I already try uselessly ignore_user_abort(False), and I don't want to set a
time limit.
¿Any ideas? ¿Am I missing something ?
Thnxs !
(Please, try avoiding those messages like "Get more resources", "Optimize
your querys", "/etc/init.d/postgresql restart", etc.)
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-php@postgresql.org
Cc: daniel.walters@hitwise.com
Subject: Re: Trouble with conections between php and postgre
In-Reply-To: <20051003222537.D15FA16E152@kyle.sinewave.com.au>
References: <226b0df80510030659m39c4f7fdn@mail.gmail.com> <20051003222537.D15FA16E152@kyle.sinewave.com.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox