From: | "Daniel Walters" <daniel(dot)walters(at)hitwise(dot)com> |
---|---|
To: | <pgsql-php(at)postgresql(dot)org> |
Subject: | Re: Trouble with conections between php and postgre |
Date: | 2005-10-03 22:26:43 |
Message-ID: | 20051003222537.D15FA16E152@kyle.sinewave.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
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(at)postgresql(dot)org [mailto:pgsql-php-owner(at)postgresql(dot)org]
On Behalf Of luis linietsky
Sent: Tuesday, October 04, 2005 12:00 AM
To: pgsql-php(at)postgresql(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | John DeSoi | 2005-10-04 01:17:15 | Re: Trouble with conections between php and postgre |
Previous Message | luis linietsky | 2005-10-03 13:59:42 | Trouble with conections between php and postgre |