php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60152 HANDLE_BLOCK_INTERRUPTIONS mismatch in _apc_store
Submitted: 2011-10-27 17:01 UTC Modified: 2012-08-14 19:53 UTC
From: askalski at gmail dot com Assigned: rasmus (profile)
Status: Closed Package: APC (PECL)
PHP Version: Irrelevant OS: n/a
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: askalski at gmail dot com
New email:
PHP Version: OS:

 

 [2011-10-27 17:01 UTC] askalski at gmail dot com
Description:
------------
The _apc_store function (php_apc.c) fails to HANDLE_UNBLOCK_INTERRUPTIONS() when returning the "Unable to allocate memory for pool." error.   (Verified that the issue exists in the 3.1.9 sources.)

Test script:
---------------
n/a

Expected result:
----------------
n/a

Actual result:
--------------
n/a

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-14 14:58 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2012-08-14 14:58 UTC] ab@php.net
Actually PHP version is not irrelevannt, as well as - this infos 

- TS or NTS
- --enable-zend-signals used while configured

Could you provide your phpinfo() and may be a way to reproduce?
 [2012-08-14 19:21 UTC] askalski at gmail dot com
I don't have a ready-made test case for this, because it involves a local modification to PHP which predates Zend signals.  It was a NTS build (Apache prefork) if that matters.  Before I go through the trouble of creating a test case (*** see note below) for something which is obvious through code reading, here is the excerpt (APC-3.1.11 beta) that I'm referring to:

int _apc_store(char *strkey, int strkey_len, const zval *val, const unsigned int ttl, const int exclusive TSRMLS_DC) {
...
...
    HANDLE_BLOCK_INTERRUPTIONS();

    APCG(current_cache) = apc_user_cache;

    ctxt.pool = apc_pool_create(APC_SMALL_POOL, apc_sma_malloc, apc_sma_free, apc_sma_protect, apc_sma_unprotect TSRMLS_CC);
    if (!ctxt.pool) {
        // XXX Need to HANDLE_UNBLOCK_INTERRUPTIONS()
        // XXX (Maybe?) Need to NULL out APCG(current_cache)?
        apc_warning("Unable to allocate memory for pool." TSRMLS_CC);
        return 0;
    }


*** It takes some effort to force apc_pool_create() to fail.  In my particular instance, the SMA spinlock acquisition timed out during a nightly virtual machine snapshot.
 [2012-08-14 19:52 UTC] rasmus@php.net
Automatic comment from SVN on behalf of rasmus
Revision: http://svn.php.net/viewvc/?view=revision&revision=327125
Log: Fix bug #60152
 [2012-08-14 19:53 UTC] rasmus@php.net
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: rasmus
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 10:01:29 2025 UTC