Bug #18221: Massive slowdown in fwrite() when not printing any text
| From: | rca at spin dot ch | Date: | Mon, 08 Jul 2002 10:07:29 +0000 |
| Subject: | Bug #18221: Massive slowdown in fwrite() when not printing any text | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-13501@lists.php.net to get a copy of this message | ||
From: rca@spin.ch
Operating system: Linux 2.2.16
PHP version: 4.1.2
PHP Bug Type: Filesystem function related
Bug description: Massive slowdown in fwrite() when not printing any text
Try the following code snippet on its own page:
$filename = "foo.txt";
$content = "blah";
$fd = fopen($filename, "a");
fwrite($fd, $content);
fwrite($fd, "\n");
fclose($fd);
You'll notice that the file is created just as intended, but the browser
will be left waiting for data for a LONG time. However, if you add this to
the end of the script:
print "test";
The page is finished and sent to the browser immediately, no delays at
all.
This was found by one of our students, not by me :)
Verified on PHP 4.1.2 using Apache 1.3.12 and 1.3.20, the former on kernel
2.2.16, the latter 2.4.2.
PHP configure line: './configure' '--with-png-dir=/usr'
'--with-mysql=/usr/local/mysql' '--with-apxs' '--with-swf=/usr/lib/
swf'
'--with-config-file-path=/etc/httpd/php.ini' '--enable-ftp'
'--with-gd=/usr/' '--with-jpeg-dir=/usr' '-- with-ttf'
'--with-zlib'
'--with-t1lib' '--with-ming'
'--with-config-file-path=/etc/httpd/php.ini'
'--enable- trans-sid' '--with-imap'
'--with-imap-ssl=/usr/include/openssl'
--
Edit bug report at http://bugs.php.net/?id=18221&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18221&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18221&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18221&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18221&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18221&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18221&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18221&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18221&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18221&r=globals