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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: need4spam at bk dot ru
New email:
PHP Version: OS:

 

 [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: Thu Apr 25 10:01:29 2024 UTC