#39063 [Opn->Fbk]: is_file() and file_exists() returning false on high load
| From: | bjori@php.net | Date: | Sun, 15 Oct 2006 21:45:37 +0000 |
| Subject: | #39063 [Opn->Fbk]: is_file() and file_exists() returning false on high load | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-103575@lists.php.net to get a copy of this message | ||
ID: 39063
Updated by: bjori@php.net
Reported By: nherdananto at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: Filesystem function related
Operating System: FreeBSD 5.5
PHP Version: 4.4.4
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
(Yes. We know you reported this against 4.4, but we want
to know if you can reproduce this under 5.2)
Running 5.2.0RC6-dev on Apache/2.0.59 worker as
apache2handler.
bjori@lindsay test$ uname -rs
FreeBSD 6.1-STABLE
bjori@lindsay test$ cat test.php
<?php
$tid = isset( $_GET['tid'] ) ? $_GET['tid'] : "";
if(!file_exists($tid)) {
echo "WRONG";
}
bjori@lindsay test$ COUNT=1; until [ $COUNT -gt 30000 ];
do touch $COUNT.txt; let COUNT+=1; done
bjori@lindsay test$ COUNT=1; until [ $COUNT -gt 344000 ];
do file=
/bin/ls | random -f - | head -n1; fetch -q -o -
http://localhost/test/test.php?tid=$file;
let COUNT+=1;
done
After ca 6hours and over 100000 requests (~5req/sec) I
haven't been able to reproduce this...
Previous Comments:
------------------------------------------------------------------------
[2006-10-06 14:58:45] nherdananto at gmail dot com
im running apache 2.0.59
and yes, threaded, limited to 256 thread.
------------------------------------------------------------------------
[2006-10-06 14:40:19] tony2001@php.net
What kind of server API are you using and is it threaded or not?
------------------------------------------------------------------------
[2006-10-06 14:20:36] nherdananto at gmail dot com
sorry, wrong code. here's the code
$tid = isset( $_GET['tid'] ) ? $_GET['tid'] : "";
$file = "/data/".$tid.".txt";
if(file_exists($file)) {
echo "1";
} else {
echo "0";
}
------------------------------------------------------------------------
[2006-10-06 14:18:50] nherdananto at gmail dot com
Description:
------------
is_file() or file_exists() returning false on existing file.
the script is executed about 8x per second and checking a file in a
directory filled with 5000 to 30000 files.
for 344000 execution, it fails about 2000 times.
no change on php.ini
Reproduce code:
---------------
$tid = isset( $_GET['tid'] ) ? $_GET['tid'] : "";
$file = "/data/".$tid.".txt";
if(file_exists()) {
echo "1";
} else {
echo "0";
}
Expected result:
----------------
for 344000 execution, it should producing 1 for 344000 times.
Actual result:
--------------
less than 344000 times of 1 echoed.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39063&edit=1