Bug #63365 [Nab]: pg_send_query() blocks on queries to other connections.

2013-06-05 Thread chris at ctgameinfo dot com
Edit report at https://bugs.php.net/bug.php?id=63365&edit=1

 ID: 63365
 User updated by:chris at ctgameinfo dot com
 Reported by:chris at ctgameinfo dot com
 Summary:pg_send_query() blocks on queries to other
 connections.
 Status: Not a bug
 Type:   Bug
 Package:PostgreSQL related
 Operating System:   FreeBSD (probably irrevelant)
 PHP Version:5.4.8
 Block user comment: N
 Private report: N

 New Comment:

It should be able to throw away the variable without closing the connection 
(much 
like calling pg_connect without assigning to a variable leaves it open). I 
realize doing this could cause a memory leak for the duration of the script, 
but 
as long as the implicit close at script termination still happens it should be 
fine.

In any case, please update the documentation to make this more clear since 
blocking on variable assignment is not something one normally expects to happen.


Previous Comments:

[2013-06-05 13:52:46] mbecc...@php.net

Sorry, hit submit too early. By overwriting the connection variable, you force 
the old connection to be closed. In order to do that, PHP is waiting for the 
query to complete and discard its output.


[2013-06-05 13:48:32] mbecc...@php.net

This won't block:



So the issue only happens when you "overwrite" an existing connection


[2012-10-28 16:24:28] chris at ctgameinfo dot com

Modified test script with requested pg_last_error output. 
---


Output:
---
Interation 1
Last error: ''
Interation 2
Last error: ''
Interation 3
Last error: ''
Interation 4
Last error: ''
Interation 5
Last error: ''
Interation 6
Last error: ''
Interation 7
Last error: ''
Interation 8
Last error: ''
Interation 9
Last error: ''
Interation 10
Last error: ''


[2012-10-28 13:57:36] fel...@php.net

Please, check out the return from pg_last_error($dbconn); after the 
pg_send_query() call and post the result in there.

----
[2012-10-25 20:58:13] chris at ctgameinfo dot com

Description:

If I open a connection and send a long running query with pg_send_query, then 
open a second connection and try to send a query over the second connection 
with 
pg_send_query it will block on the first connection's query not being complete

Test script:
---


Expected result:

pg_send_query should only block on incomplete queries on the same connection.

Actual result:
--
pg_send_query blocks on incomplete queries on any connection.






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63365&edit=1


Bug #38104 [Com]: session_start()/session_write_close() creates multiple session cookies headers

2012-09-25 Thread chris at ctgameinfo dot com
Edit report at https://bugs.php.net/bug.php?id=38104&edit=1

 ID: 38104
 Comment by: chris at ctgameinfo dot com
 Reported by:m dot v dot veluw dot smscity at gmail dot com
 Summary:session_start()/session_write_close() creates
 multiple session cookies headers
 Status: Not a bug
 Type:   Bug
 Package:Session related
 Operating System:   any
 PHP Version:5.1.4
 Block user comment: N
 Private report: N

 New Comment:

According to rfc6265 it definitely is a bug

"Servers SHOULD NOT include more than one Set-Cookie header field in the same 
response with the same cookie-name."


Previous Comments:

[2012-05-08 17:02:13] andries dot malan at gmail dot com

I believe the problem is a missing PHP capability for session handling,without 
which no efficient solution is possible for this problem.

In addition to session_start() and session_write_close(), PHP should have a 
session_write_reopen() function.

This would solve several problems cleanly.

It will allow for those that want fine-grained control over the transaction 
handling/demarcation when accessing session variables, without imposing any 
additional complications on those that just want the default session handling 
behavior.

for example:

at the top of all pages you start your session with:
session_start(); session_write_close(); //no further blocking

//.. rest of long running script execution

//now we only block for tiny fraction of time while manipulating session vars
startSessionTransaction();
$x = $_SESSION['x'];
$x++;
$_SESSION['x] = $x;
endSessionTransaction();
//now we stop block

//... script can continue running tedious operations without blocking others on 
session access 
//...


and the user would then implement these

function startSessionTransaction()
{
  session_write_reopen();
}

function endSessionTransaction()
{
  session_write_close();
}


Now you can only let your session handling part of your script block for the 
tiny parts when a session variable is manipulated, without 
having to completely restart sessions, because restarting sessions later in 
your 
script creates several additional problems as noted - such as creating 
duplicate 
session cookies, and just as annoying, force you to turn on output buffering 
for 
your entire script, since you cannot start (or restart) session's once any 
output has been sent to the browser.

This is the solution required. This is what is missing in PHP session 
functionality. IMNSHO


[2011-11-20 05:22:52] danielc at analysisandsolutions dot com

See also https://bugs.php.net/bug.php?id=31455


[2011-11-09 18:34:52] rfunk at funknet dot net

I just ran into this bug in PHP 5.3.5 when working with a script that does lots 
 
of 
session_start()/session_write_close() in a long-running task, so that separate 
requests can still access the 
session during that long task. (Specifically those separate requests are 
checking the progress of the long 
task.)

The resulting absurdly redundant Set-Cookie header caused Firefox 7 to lock up 
for a few seconds, and caused IE8 
to give its infamously useless "Internet Explorer cannot display the webpage" 
page. So this bug is not "Bogus" s 
it claims.

I do have a workaround, however. I'm already doing an ob_start() at the top of 
the script, and now before the 
ending ob_end_flush() I replace the Set-Cookie header with a new one:

  if (SID) header('Set-Cookie: '.SID.'; path=/', true);

After adding this, I no longer have the above problems in Firefox and IE.


[2011-02-04 17:00:58] vdklah at hotmail dot com

I can not tell how much I disagree on this. Calling session_start() followed by 
session_write_close() is a very valid way to avoid blocking multiple processes. 
(See also here http://konrness.com/php5/how-to-prevent-blocking-php-requests/.) 
This problem is huge since we are facing fatal crashing clients due to zillions 
of duplicate PHPSESSID entries in one cookie. Our server is big and complicated 
and so we are not willing to change anything in this area while all is already 
taken in production. Totally stuck on this and I'm not happy. This is a very 
obvious PHP bug that can be proven in 4 lines of code without any client 
intervention.


[2006-07-14 20:46:11] il...@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-repor

[PHP-BUG] Bug #63365 [NEW]: pg_send_query() blocks on queries to other connections.

2012-10-25 Thread chris at ctgameinfo dot com
From: chris at ctgameinfo dot com
Operating system: FreeBSD (probably irrevelant)
PHP version:  5.4.8
Package:  PostgreSQL related
Bug Type: Bug
Bug description:pg_send_query() blocks on queries to other connections.

Description:

If I open a connection and send a long running query with pg_send_query,
then 
open a second connection and try to send a query over the second connection
with 
pg_send_query it will block on the first connection's query not being
complete

Test script:
---


Expected result:

pg_send_query should only block on incomplete queries on the same
connection.

Actual result:
--
pg_send_query blocks on incomplete queries on any connection.

-- 
Edit bug report at https://bugs.php.net/bug.php?id=63365&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63365&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63365&r=trysnapshot53
Try a snapshot (trunk): 
https://bugs.php.net/fix.php?id=63365&r=trysnapshottrunk
Fixed in SVN:   https://bugs.php.net/fix.php?id=63365&r=fixed
Fixed in release:   https://bugs.php.net/fix.php?id=63365&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=63365&r=needtrace
Need Reproduce Script:  https://bugs.php.net/fix.php?id=63365&r=needscript
Try newer version:  https://bugs.php.net/fix.php?id=63365&r=oldversion
Not developer issue:https://bugs.php.net/fix.php?id=63365&r=support
Expected behavior:  https://bugs.php.net/fix.php?id=63365&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=63365&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=63365&r=submittedtwice
register_globals:   https://bugs.php.net/fix.php?id=63365&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63365&r=php4
Daylight Savings:   https://bugs.php.net/fix.php?id=63365&r=dst
IIS Stability:  https://bugs.php.net/fix.php?id=63365&r=isapi
Install GNU Sed:https://bugs.php.net/fix.php?id=63365&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63365&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=63365&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63365&r=mysqlcfg



Bug #63365 [Fbk->Opn]: pg_send_query() blocks on queries to other connections.

2012-10-28 Thread chris at ctgameinfo dot com
Edit report at https://bugs.php.net/bug.php?id=63365&edit=1

 ID: 63365
 User updated by:chris at ctgameinfo dot com
 Reported by:chris at ctgameinfo dot com
 Summary:pg_send_query() blocks on queries to other
 connections.
-Status: Feedback
+Status: Open
 Type:   Bug
 Package:PostgreSQL related
 Operating System:   FreeBSD (probably irrevelant)
 PHP Version:5.4.8
 Block user comment: N
 Private report: N

 New Comment:

Modified test script with requested pg_last_error output. 
---


Output:
---
Interation 1
Last error: ''
Interation 2
Last error: ''
Interation 3
Last error: ''
Interation 4
Last error: ''
Interation 5
Last error: ''
Interation 6
Last error: ''
Interation 7
Last error: ''
Interation 8
Last error: ''
Interation 9
Last error: ''
Interation 10
Last error: ''


Previous Comments:

[2012-10-28 13:57:36] fel...@php.net

Please, check out the return from pg_last_error($dbconn); after the 
pg_send_query() call and post the result in there.

------------
[2012-10-25 20:58:13] chris at ctgameinfo dot com

Description:

If I open a connection and send a long running query with pg_send_query, then 
open a second connection and try to send a query over the second connection 
with 
pg_send_query it will block on the first connection's query not being complete

Test script:
---


Expected result:

pg_send_query should only block on incomplete queries on the same connection.

Actual result:
--
pg_send_query blocks on incomplete queries on any connection.






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63365&edit=1