#20004 [NEW]: ignore_user_abort() and connection_aborted()
| From: | buvry at enseeiht dot fr | Date: | Mon, 21 Oct 2002 08:53:11 +0000 |
| Subject: | #20004 [NEW]: ignore_user_abort() and connection_aborted() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-22941@lists.php.net to get a copy of this message | ||
From: buvry@enseeiht.fr
Operating system: Solaris 7
PHP version: 4.2.3
PHP Bug Type: PHP options/info functions
Bug description: ignore_user_abort() and connection_aborted()
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 bug report at http://bugs.php.net/?id=20004&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=20004&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=20004&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=20004&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=20004&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=20004&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=20004&r=support
Expected behavior: http://bugs.php.net/fix.php?id=20004&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=20004&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=20004&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=20004&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20004&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=20004&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=20004&r=isapi