#48321 [Opn->Bgs]: flock() blocks within function regardless of operation
ID: 48321
Updated by: jani@php.net
Reported By: php at alishabeth dot com
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: Ubuntu 9.04
PHP Version: 5.2.6
New Comment:
This is really simple actually. Move the sleep inside the function and
it will work the same way as the "inline" version.
What happens is when you use the function, once the function is run,
there are no more references pointing to the opened file pointer and
it's garbage cleaned (and unlocked) before your sleep() call.
Previous Comments:
------------------------------------------------------------------------
[2009-05-19 17:48:48] php at alishabeth dot com
Is anyone able to reproduce on previous versions such as those I've
found it on?
If so should the documentation be updated to note this issue?
------------------------------------------------------------------------
[2009-05-19 17:44:50] lbarnaud@php.net
Can't reproduce on 5.2.9.
------------------------------------------------------------------------
[2009-05-19 17:29:41] php at alishabeth dot com
I'm sorry, building your latest source to test this further is not
something I can do. I'm hopeful that you have enough developers that
you can use the test case I provided to reproduce this yourselves.
Thanks
------------------------------------------------------------------------
[2009-05-19 07:37:07] lbarnaud@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
------------------------------------------------------------------------
[2009-05-18 22:15:36] php at alishabeth dot com
Description:
------------
Placing flock() calls within a function seems to result in blocking
regardless of the operations specified. The same exact code outside a
function behaves correctly.
This bug report wouldn't let me select the PHP version I'm running.
Wasn't an option
Reproduce code:
---------------
http://alishabeth.com/lock-test.php.txt
Reproduced in the following builds:
$ php -v
PHP 5.1.6 (cli) (built: Apr 7 2009 08:00:18)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator,
by eAccelerator
$ php -v
PHP 5.2.6-3ubuntu4.1 with Suhosin-Patch 0.9.6.2 (cli) (built: Apr 23
2009 14:37:14)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
with Xdebug v2.0.3, Copyright (c) 2002-2007, by Derick Rethans
Expected result:
----------------
Using the function always blocks
Actual result:
--------------
Flock should behave correctly within the function
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48321&edit=1
Thread (8 messages)