#20004 [Fbk->NoF]: ignore_user_abort() and connection_aborted()
ID: 20004
Updated by: sniper@php.net
Reported By: buvry@enseeiht.fr
-Status: Feedback
+Status: No Feedback
Bug Type: PHP options/info functions
Operating System: Solaris 7
PHP Version: 4.2.3
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2002-10-21 03:56:12] sander@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-latest.zip
------------------------------------------------------------------------
[2002-10-21 03:53:11] buvry@enseeiht.fr
I use Apache 1.3.26 and postgresql 7.2.2
I wished to test ignore_user_abort() and connection_aborted(). I can
not use correctly
this 2 fonctions. The result is always the same.
The application is the famous example of the bank accounts and the
money transfers. I consider a table named "DEAL" where each transaction
is saved. Each tuple has an id
number as key.
My script php follows this steps :
ignore_user_abort(0|1)
Compute the key -> v
BEGIN WORK
UPDATE the first bank account with v (credit)
sleep(300)
UPDATE the second bank account with v+1 (debit)
COMMIT WORK
While the sleep, the client uses the STOP button on his browser and
stops the connection.
For these tests, I follow two steps :
1/ the client execute the first request but stops the connection
while the sleep instruction.
2/ with pgaccess, I read the content of DEAL after a while
--------------------
TEST 1
--------------------
ignore_user_abort(0)
Compute the key -> v
BEGIN WORK
UPDATE the first bank account with v as key (credit)
sleep(300) ------> INTERRUPT !!!!
UPDATE the second bank account with v+1 as key (debit)
COMMIT WORK
Result : after a while (timeout ?), the request is
executed. Therefore the script is executed totally.
Otherwise, this timeout is also a problem because if
the client make again his request, it fails beacause
the found key is the same as the previous and one update
fails (but this problem comes from the first problem) !
--------------------
TEST 2
--------------------
The same by removing BEGIN and COMMIT.
The result is the same, even if the "timeout" is more
important.
--------------------
TEST 3 and 4
--------------------
The tests 3 and 4 reproduce the test 1 and 2 by using
ignore_user_abort(1).
The results are absolutely the same !
--------------------
TEST 5 and 6
--------------------
The tests 5 and 6 reproduce the test 1 and 2 by using ROLLBACK
if ( connection_aborted() ) { ROLLBACK WORK; exit } is added
after the sleep.
The results are absolutely the same again ! It seem
connection_aborted does not return correct result.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20004&edit=1
Thread (3 messages)