|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59582 apc_sem_lock: semop failed (sem get destroyed by fpm daemonization)
Submitted: 2011-01-17 17:06 UTC Modified: 2016-11-18 21:50 UTC
Avg. Score:4.2 ± 0.8
Reproduced:3 of 4 (75.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: need4spam at bk dot ru Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: 5.3.2 OS: FreeBSD-8.1
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-01-17 17:06 UTC] need4spam at bk dot ru
When php-fpm has "daemonize yes" in it's config and APC compiled with semaphores. 
After php-fpm's second fork semaphores get destroyed by PHP_MSHUTDOWN_FUNCTION of exiting process.

Reproduce code:
PHP Shutdown: apc_module_shutdown
PHP Shutdown: Destroyed lock 7602177
PHP Shutdown: Destroyed lock 7602178
Fatal error: Unknown: apc_sem_lock: semop(7602177) failed: in Unknown on line 0


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-18 02:31 UTC]
Any particular reason to use semaphores over fcntl?

Semaphore locking is deprecated & not very fast (mostly left in place for Solaris folks).

The only reason the code works for apache is that www-data is not allowed to remove a semaphore owned by root. This is kinda known bug, but fixing it leaves semaphores hanging on process exit, which is kinda bad.

It's kinda annoying that pthread mutexes can't be used until fbsd libc implements process shared fast mutexes.
 [2011-02-03 07:55 UTC] need4spam at bk dot ru
I was just testing perfomance of semaphres on our platform. 
You were right - fnctl is good enough.
May be we shall switch to Linux and test rwlocks performance.

PS. Is there any plans to add RCU ( ) to APC?
 [2016-11-18 21:50 UTC]
-Status: Open +Status: Wont fix
 [2016-11-18 21:50 UTC]
APC is no longer supported in favor of opcache that comes bundled with PHP, if you wish to use the user cache, then look at PECL/APCu.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Feb 21 13:01:28 2024 UTC