ID:               45013
 Comment by:       www at qaaa dot de
 Reported By:      andre at koethur dot de
 Status:           No Feedback
 Bug Type:         Semaphore related
 Operating System: Linux
 PHP Version:      4.4.8
 New Comment:

Same problem now with PHP 5.3.0


Previous Comments:
------------------------------------------------------------------------

[2008-07-19 01:00:00] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------

[2008-07-11 21:46:00] [email protected]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi

If you can reproduce this problem using latest PHP 5.2 snapshot, update
the version string to contain: 5.2CVS-2008mmdd

------------------------------------------------------------------------

[2008-05-15 20:47:33] andre at koethur dot de

Description:
------------
If I acqure a semaphore in one script, then it is not possible to 
release it in another script, even if I set "auto_release" to false.

As I have found out, it has something to do with the "count" attribute

of the "sysvsem_sem"-structure. This value is really only needed by 
the 
"auto_release"-functionality, so it should be safe to ignore it in 
php_sysvsem_semop()-function.

The current cvs-version of sysvsem.c says on line 290:
if (!acquire && sem_ptr->count == 0)

I suggest to change it to:
if (!acquire && sem_ptr->count == 0 && sem_ptr->auto_release)






Reproduce code:
---------------
First script, acquire semaphore:

<?php

$sem_id = sem_get(2405, 1, 0666, false);
if ($sem_id !== false) if (sem_acquire($sem_id)) echo 'Sem acquired!';

?>

Second script, release semaphore:

<?php

$sem_id = sem_get(2405, 1, 0666, false);
if ($sem_id !== false) if (sem_release($sem_id)) echo 'Sem released!';

?>



Expected result:
----------------
The second script should run without errors/warnings and the semaphore

should be released.

Actual result:
--------------
Warning: sem_release() [function.sem-release]: SysV semaphore 2 (key 
0x965) is not currently acquired


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45013&edit=1

Reply via email to