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:
- The error message does not appear every time the script is running.
- I indeed get sometimes the error 'Error acquiring Semaphore' with the similar warining 'sem_acquire(): failed to acquire key 0xc: Identifier removed', BUT not at the same time(day) I get the 'Error releasing Semaphore'
- The class above is used all over the place with different keys to synchronize part of application code. I'm not having ANY issues with other keys. And yes, this key "12"/"0xc" is beeing used ONLY in one place and from the same user.
- Issues with permission should not occure, because if you check the permisson of the semaphore "0xc" is "666"