I'm using semaphore to synchronize some parts in my application.
On releasing of the semaphore (sem_release) I'm getting this warning:
sem_release(): failed to release key 0xc: Invalid argument
First I don't know whether the semaphore released, but since I'm not getting "true" as result, I guess it's not releasing.
PHP Version: 5.6.30
ipcs -V => ipcs from util-linux 2.25.2
Here is the semaphore:
key semid owner perms nsems
0x0000000c 4124122 myUser 666 3
Here is part of the code (class Synchronization):
...
if ( !( $this->semaphoreId = sem_get( $this->id, 1 ) ) )
throw new RuntimeException( 'Error getting Semaphore.');
...
if ( !sem_acquire( $this->semaphoreId ) )
throw new RuntimeException( 'Error acquiring Semaphore.');
...
if ( !sem_release( $this->semaphoreId ) )
throw new RuntimeException( 'Error releasing Semaphore.');
P.S. I'm getting this error only in my productive environment and I'm not able to reproduce/debug in in my test environment.
I searched on Internet for this error message, but I found nothing.
Does anyone knows what this message means?
Edited:
Could you follow the steps from the beginning:
resource sem_get ( int $key [, int $max_acquire = 1 [, int $perm = 0666 [, int $auto_release = 1 ]]] )
bool sem_acquire ( resource $sem_identifier [, bool $nowait = false ] )
and add sanity checks to make sure that the above function are returning the expected value.
Could you also check if the other part of your application runs under the same user to avoid permission issues.
User contributions licensed under CC BY-SA 3.0