php.net |  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
Votes:4
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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
36 - 28 = ?
Subscribe to this entry?

 
 [2011-01-17 17:06 UTC] need4spam at bk dot ru
Description:
------------
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: PHP_MSHUTDOWN_FUNCTION
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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-18 02:31 UTC] gopalv@php.net
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 ( 
http://en.wikipedia.org/wiki/Read-copy-update ) to APC?
 [2016-11-18 21:50 UTC] kalle@php.net
-Status: Open +Status: Wont fix
 [2016-11-18 21:50 UTC] kalle@php.net
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: Fri Mar 29 14:01:28 2024 UTC