Edit report at http://bugs.php.net/bug.php?id=51771&edit=1
ID: 51771 Comment by: crrodriguez at opensuse dot org Reported by: kulakov74 at yandex dot ru Summary: fclose() seems not to unlock the file Status: Open Type: Bug Package: Filesystem function related Operating System: Linux PHP Version: 5.3.2 New Comment: Correct, take look at the changelog..it clearly says: "Removed automatic file descriptor unlocking happening on shutdown and/or stream close (on all OSes). (Tony, Ilia)" aka. the correct behaviour. Previous Comments: ------------------------------------------------------------------------ [2010-05-08 11:48:04] kulakov74 at yandex dot ru Description: ------------ We have a script that runs in a multiprocess way and it uses flock() for interprocess communication. Things worked fine until we moved to PHP 5.3.2 where all the processes started to hang all of a sudden. I debugged the issues and tried several fixes but they didn't solve it. I made an extensive log of all the script did in order to find out the reason, and I got a situation with 4 scripts running trying to get a non-blocking lock every second, and all of them wrote "lock failed" to the log. At the same time none of them was supposed to hold the lock at that time. Finally I added an flock($hLock, LOCK_UN); before every fclose($hLock); and it is only that that they stopped handing. Test script: --------------- $H=fopen($LockFile, 'a'); flock($H, LOCK_EX); //... //flock($H, LOCK_UN); - the fix fclose($H); Expected result: ---------------- no deadlock Actual result: -------------- Deadlock ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51771&edit=1