Bug #54062 [Fbk->Opn]: PHP does not notice user abort
| From: | james dot mk dot green at gmail dot com | Date: | Mon, 21 Feb 2011 21:46:08 +0000 |
| Subject: | Bug #54062 [Fbk->Opn]: PHP does not notice user abort | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-158946@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54062&edit=1
ID: 54062
User updated by: james dot mk dot green at gmail dot com
Reported by: james dot mk dot green at gmail dot com
Summary: PHP does not notice user abort
-Status: Feedback
+Status: Open
Type: Bug
Package: Network related
Operating System: Linux/Windows
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
As unlikely as it sounds this may be an issue within Firefox.
I pasted the code from Rasmus onto the web server next door to mine.
Fired it up
in Firefox and PHP detected the user abort. Repeated my script but again
it did
not work. Slowly I worked the code from Rasmus directly in to my script
but
still no joy. At this point all that was different was the name of the
shutdown
function. Then tried using wget as the client and both scripts work.
Repeated
Rasmus' script from Firefox and it no longer detected user abort.
So we have a bug within the client - as far as I can tell. I am least
happy I
can work with this, thanks for all the tests and sorry for wasting
people's
time!
Previous Comments:
------------------------------------------------------------------------
[2011-02-21 19:40:41] rasmus@php.net
By the way, why so complicated a test?
Try the simple case:
<?php
ignore_user_abort(false);
for($i=0;$i<1000;$i++) {
sleep(1);
$str = "Line $i\n";
echo $str;
flush();
file_put_contents("/tmp/heartbeat.log", $str, FILE_APPEND);
}
Things that might get in the way of this working for you would be if you
have
some sort of reverse proxy cache in front of your web server. Like a
Cloudflare,
for example. Or your own setup. You could also have multiple levels of
output
buffering going on. You could check that case with an ob_get_level()
call.
------------------------------------------------------------------------
[2011-02-21 19:21:05] rasmus@php.net
Works fine for me on a Debian box running mod_php with Apache prefork,
and a
Centos box running nginx and php-fpm.
------------------------------------------------------------------------
[2011-02-21 17:42:42] james dot mk dot green at gmail dot com
johannes, it's been tested on a Windows server too (same behaviour).
Besides, cataphract seems to be using Ubuntu's PHP package too.
Perhaps it's something to do with web server configuration? I'm using
CGI on Windows, and mod_php on Ubuntu (Apache Prefork MPM). What might
cause this behaviour?
------------------------------------------------------------------------
[2011-02-21 17:39:22] johannes@php.net
Please try using this snapshot:
http://snaps.php.net/php5.3-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Please use vanilla PHP from php.net. We have no idea what kind of
patches Ubuntu applies and what they might break.
------------------------------------------------------------------------
[2011-02-21 17:31:59] james dot mk dot green at gmail dot com
Feb 21 16:28:57 blofeld apache2: The connection remains
Feb 21 16:29:41 blofeld apache2: Connection opened
Feb 21 16:29:43 blofeld apache2: Completed usleep()
Feb 21 16:29:43 blofeld apache2: ob_end_flush() called
Feb 21 16:29:43 blofeld apache2: Have flushed()
Feb 21 16:29:43 blofeld apache2: Echo completed
Feb 21 16:29:43 blofeld apache2: Have slept
Feb 21 16:29:43 blofeld apache2: Shutdown detected.
Feb 21 16:29:43 blofeld apache2: The result of connection_status() is:
0
Feb 21 16:29:43 blofeld apache2: The connection remains
That's what I get using Firefox with PHP 5.3.3-1ubuntu9.3 on apache
2.2.16-1ubuntu3.1 using ubuntu Ubuntu 10.10.
All I do is type in the url of my disconnect.php, hit enter then
immediately hit the stop button.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=54062
--
Edit this bug report at http://bugs.php.net/bug.php?id=54062&edit=1