php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27584 flush sometimes don't work
Submitted: 2004-03-12 21:45 UTC Modified: 2004-05-11 17:01 UTC
From: xuefer at 21cn dot com Assigned: iliaa (profile)
Status: Not a bug Package: Apache2 related
PHP Version: 4CVS-2004-03-13 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: xuefer at 21cn dot com
New email:
PHP Version: OS:

 

 [2004-03-12 21:45 UTC] xuefer at 21cn dot com
Description:
------------
it works under apache1, but not on apache2
this script is used for network-speed testing

yet, i don't know if it's relative to php or apache


Reproduce code:
---------------
<?php
header("Content-Type: binary");
// while (@ob_clean());
set_time_limit(5); // may be 1
$fp = fopen("/dev/urandom");
$u = fread($fp, 1024 * 1024); // 1mb
while (1) {
	echo $u;
	ob_flush(); flush();
}
?>


Expected result:
----------------
under apache1, each time request to this file will download start from 0% immediately
tested under IE & Flashget

Actual result:
--------------
but under apache2, 1st time seems ok, cancel IE download or stopped flashget, then try again(with "Rang" header), download will not start until script is timedout, then, start with a content-length in response header
the process of apache2 is taking so much memory about XXmb even 1XXmb

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-13 11:23 UTC] xuefer at 21cn dot com
tested with lastest build

without Rang:
Sun Mar 14 00:30:21 2004 GET /test.php HTTP/1.1
Sun Mar 14 00:30:21 2004 Host: 127.0.0.1
Sun Mar 14 00:30:21 2004 Accept: */*
Sun Mar 14 00:30:21 2004 User-Agent: Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)
Sun Mar 14 00:30:21 2004 Pragma: no-cache
Sun Mar 14 00:30:21 2004 Cache-Control: no-cache
Sun Mar 14 00:30:21 2004 Connection: close
Sun Mar 14 00:30:21 2004 HTTP/1.1 200 OK
Sun Mar 14 00:30:21 2004 Date: Sat, 13 Mar 2004 16:30:21 GMT
Sun Mar 14 00:30:21 2004 Server: Apache/2.0.48 (Win32)
Sun Mar 14 00:30:21 2004 Connection: close
Sun Mar 14 00:30:21 2004 Transfer-Encoding: chunked
Sun Mar 14 00:30:21 2004 Content-Type: binary


with Rang:
Sun Mar 14 00:31:41 2004 GET /test.php HTTP/1.1
Sun Mar 14 00:31:41 2004 Host: 127.0.0.1
Sun Mar 14 00:31:41 2004 Accept: */*
Sun Mar 14 00:31:41 2004 User-Agent: Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)
Sun Mar 14 00:31:41 2004 Range: bytes=839516-
Sun Mar 14 00:31:41 2004 Pragma: no-cache
Sun Mar 14 00:31:41 2004 Cache-Control: no-cache
Sun Mar 14 00:31:41 2004 Connection: close
Sun Mar 14 00:31:42 2004 HTTP/1.1 200 OK
Sun Mar 14 00:31:42 2004 Date: Sat, 13 Mar 2004 16:31:41 GMT
Sun Mar 14 00:31:42 2004 Server: Apache/2.0.48 (Win32)
Sun Mar 14 00:31:42 2004 Content-Range: bytes 839516-96413656/96413657
Sun Mar 14 00:31:42 2004 Content-Length: 95574141
Sun Mar 14 00:31:42 2004 Connection: close
Sun Mar 14 00:31:42 2004 Content-Type: binary
 [2004-03-15 09:42 UTC] sniper@php.net
Can you verify if this happens with Apache 1 too..?

 [2004-03-15 09:52 UTC] xuefer at 21cn dot com
my expected result works under apache1
and failed(actual result) under apache2


so what? apache2 bug itself?
 [2004-03-16 11:44 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

flushing works differently in ap2 then it does in ap1,  
which may explain the different output.  
 
P.S. Seems to work equally well in ap1 and ap2 on Linux 
however. 
 [2004-03-16 11:45 UTC] iliaa@php.net
read above message 
 [2004-04-22 13:10 UTC] xuefer at 21cn dot com
php apache2handler should remove "BYTERANGE" outputfilter

example code is in:
./modules/experimental/cache_util.c
line 82

CACHE_DECLARE(void) ap_cache_reset_output_filters(request_rec *r)
{
    ap_filter_t *f = r->output_filters;

    while (f) {
        if (!strcasecmp(f->frec->name, "CORE") ||
            !strcasecmp(f->frec->name, "CONTENT_LENGTH") ||
            !strcasecmp(f->frec->name, "HTTP_HEADER")) {
            f = f->next;
            continue;
        }
        else {
            ap_remove_output_filter(f);
            f = f->next;
        }
    }
}
 [2004-04-29 23:08 UTC] sniper@php.net
Ilia, check above comment..

 [2004-05-11 15:51 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

PHP cannot possibly predict all ap2 filters that may 
conflict with PHP output and it would not be a good idea 
(IMHO) to remove all filters before executing PHP. I'd say 
it is up to the user to determine which filters are 
possibly incompatible and handle the situation 
appropriately. 
 [2004-05-11 15:52 UTC] iliaa@php.net
oops ment to bogus it. 
 [2004-05-11 16:55 UTC] xuefer at 21cn dot com
i've already tried "RemoveOutputFilter" in httpd.conf of apache2
but with no luck, it's an internal filter

should apache or php solve this bug?
 [2004-05-11 17:01 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

I'd say that this is an Apache issue and not a PHP one. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 05:01:30 2024 UTC