I have a parent-child processes using shared memory. Child put data into shared memory about 10 times per second. Parent and child are using semaphore to lock resource while writing/reading. This solution works for several hours and then I start getting warnings:
PHP Warning: sem_acquire(): failed to acquire key 0x4101f1fb: Invalid argument in script.php on line 350
PHP Warning: sem_release(): SysV semaphore 140105644163240 (key 0x4101f1fb) is not currently acquired in script.php on line 354
It looks like the script is over some limit and semaphore destroyed, but I can't find anything in ipcs referring to the current limits/use.
I also tried to sem_get in order to get new semaphore ID but I can't pass it to child via shared memory shm_put_var is not working with resources.
What is the best way to handle semaphores in that long run processes?
Could be an ever-existing bug in PHP:
https://bugs.php.net/bug.php?id=44109
The first (and only) comment speaks of ~32000 semaphore identifiers and that the number is not adjustable...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With