ID:               39987
 User updated by:  wojtekm86 at konto dot pl
 Reported By:      wojtekm86 at konto dot pl
-Status:           Bogus
+Status:           Open
 Bug Type:         Semaphore related
 Operating System: Linux
 PHP Version:      5.2.0
 New Comment:

I'm changing the status to Open


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

[2006-12-31 08:24:09] wojtekm86 at konto dot pl

I think you don't understand me.
I know that sem_release doesn't remove the semaphore but I think it
should because it's the one and only way to do it correct, of course if
current process, which releases a semaphore, is the last one which
acquired it.

Please, read one more time bug's description.
I think you didn't understand my intention.

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

[2006-12-30 23:19:34] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

if you want to remove the semaphore you need to call the 
sem_remove() function. Closing the semaphore won't remove it 
no more so then closing a file will remove it from disk.

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

[2006-12-30 10:54:20] wojtekm86 at konto dot pl

I think that there is also a problem with parameter max_acquire because
value in column nsems always equals 3

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

[2006-12-29 17:45:15] wojtekm86 at konto dot pl

Next code.

I have a test script with code as follows:

<?php
$id = sem_get(10);
sem_acquire($id);
for($ind = 0; $ind < 10000; $ind++) { }
sem_release($id);
?>

I run it only once.

The result I get after execute command ipcs -s on the server:

------ Semaphore Arrays --------
key        semid      owner      perms      nsems     
0x0000000a 131075     www_php-a 666        3         

It seems that there is a problem with semaphores' removal after
release.

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

[2006-12-29 17:33:32] wojtekm86 at konto dot pl

I think it doesn't.
In my script I have class Semaphore.
There are methods like acquire() and release().
After each sem_acquire instruction I wrote:

echo('I\'ve  acquired semaphore key: ' . $this->key . '<br>');

After each  sem_release instruction I wrote:

echo('I\'ve released semaphore key: ' . $this->key . '<br>');

I have executed script only once.
The result I saw is:

I've acquired semaphore key: 1376159737
I've released semaphore key: 1376159737
I've acquired semaphore key: 1376159747
I've released semaphore key: 1376159747
I've acquired semaphore key: 1376159737
I've released semaphore key: 1376159737
I've acquired semaphore key: 1376159748
I've released semaphore key: 1376159748
I've acquired semaphore key: 1376159737
I've released semaphore key: 1376159737
I've acquired semaphore key: 1376159749
I've released semaphore key: 1376159749

As you can see each semaphore is released.
But when I run command ipcs -s on my server I get:

------ Semaphore Arrays --------
key        semid      owner      perms      nsems     
0x520687e6 131075     www_php-a 600        3         
0x520687f9 163844     www_php-a 600        3         
0x520687fa 196613     www_php-a 600        3         
0x520687fc 229382     www_php-a 600        3         
0x520687e9 262151     www_php-a 600        3         
0x520687fd 294920     www_php-a 600        3         
0x520687fe 327689     www_php-a 600        3         
0x520687ff 360458     www_php-a 600        3         
0x52068800 393227     www_php-a 600        3         
0x52068801 425996     www_php-a 600        3         
0x52068802 458765     www_php-a 600        3         
0x52068803 491534     www_php-a 600        3         
0x52068804 524303     www_php-a 600        3         
0x52068805 557072     www_php-a 600        3         

You can see that there are not removed semaphores.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/39987

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

Reply via email to