From: henrique dot grolli at gmail dot com Operating system: Slackware Linux PHP version: 5.2.6 PHP Bug Type: Filesystem function related Bug description: Problems with file_exists and multiple instances
Description: ------------ Well, better explained when seeing the code. Not acting as expected via web browser as the both instances execute as the lock file was not created by another instance but doing it well via shell console. Same problem using clearstatcache() function. Reproduce code: --------------- // LOCK_FILE was defined to /tmp/test.lock // creating the lock file if(file_exists(LOCK_FILE)) { echo "ANOTHER INSTANCE RUNNING\n"; exit(1); } else { touch(LOCK_FILE); } /* any action that takes time*/ echo "running\n"; sleep(5); // simulating slow scripts echo "done\n"; if(file_exists(LOCK_FILE)) { unlink(LOCK_FILE); } else { echo "I think someone deleted the lock file\n"; } Expected result: ---------------- To see "running\ndone\n" in one instance, and "ANOTHER INSTANCE RUNNING\n" if another instance try to execute at the same time. Actual result: -------------- Via shell everything works as well but via web browser both instances run as the lock file doesnt exist. -- Edit bug report at http://bugs.php.net/?id=46197&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46197&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46197&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46197&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46197&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=46197&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46197&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46197&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46197&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46197&r=support Expected behavior: http://bugs.php.net/fix.php?id=46197&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46197&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46197&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46197&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46197&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46197&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46197&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46197&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46197&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46197&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46197&r=mysqlcfg