php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20004 ignore_user_abort() and connection_aborted()
Submitted: 2002-10-21 03:53 UTC Modified: 2002-11-10 18:23 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: buvry at enseeiht dot fr Assigned:
Status: No Feedback Package: PHP options/info functions
PHP Version: 4.2.3 OS: Solaris 7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: buvry at enseeiht dot fr
New email:
PHP Version: OS:

 

 [2002-10-21 03:53 UTC] buvry at enseeiht dot 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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-21 03:56 UTC] 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-11-10 18:23 UTC] sniper@php.net
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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 12 21:01:28 2024 UTC