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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 14:01:34 2024 UTC